List blueprints

GET  /blueprint

Overview

List all of your saved blueprints.

Each entry includes the blueprint ID and name, access control, and user information.

The provided blueprint IDs are required to access the other blueprint-related APIs.

Response

OK

Expand All

Field

Type

Description

blueprints

array

An array of blueprint metadata.

{
  "blueprints": [
    {
      "CreatorId": "us46e9aa-5806-4cd6-8e78-c22d58602d09",
      "LastUserId": "us46e9aa-5806-4cd6-8e78-c22d58602d09",
      "createdAt": "2022-01-01T20:54:47.302Z",
      "id": "bp37712a-c507-4c62-ad8b-7d981cacb3be",
      "name": "Web App Reference Architecture",
      "updatedAt": "2022-01-01T20:55:52.876Z"
    }
  ]
}

Unauthorized

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

blueprints = cloudcraft.list_blueprints()

Create a blueprint

POST  /blueprint

Overview

Create a new blueprint.

The body of the request should contain the blueprint document in JSON format. The response contains the created blueprint, including the newly assigned ID.

Response

OK

Expand All

Field

Type

Description

CreatorId

string

The user ID of the creator of the blueprint.

LastUserId

string

The user ID of the last user to modify the blueprint.

createdAt

string

The date and time the blueprint was created.

data

object

The definition of the blueprint.

id

string

The unique identifier of the blueprint.

updatedAt

string

The date and time the blueprint was last updated.

{
  "CreatorId": "us46e9aa-5806-4cd6-8e78-c22d58602d09",
  "LastUserId": "us46e9aa-5806-4cd6-8e78-c22d58602d09",
  "createdAt": "2022-01-01T20:59:57.340Z",
  "data": {
    "grid": "standard",
    "name": "My new blueprint",
    "version": 1
  },
  "id": "bp37712a-c507-4c62-ad8b-7d981cacb3be",
  "updatedAt": "2022-01-01T20:59:57.340Z"
}

Unauthorized

Forbidden, insufficient privileges

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

data = {"data": {"grid": "standard", "name": "New blueprint"}}
result = cloudcraft.create_blueprint(data)

Delete a blueprint

DELETE  /blueprint/{blueprint_id}

Overview

Delete a blueprint.

When the deletion succeeds, 204 No Content is returned.

Path Parameters

  • blueprint_id: UUID. Blueprint ID. Required.

Response

OK

Unauthorized

Forbidden, insufficient privileges

Blueprint not found

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

blueprint_id = 1234
result = cloudcraft.delete_blueprint(blueprint_id)

Retrieve a blueprint

GET  /blueprint/{blueprint_id}

Overview

Retrieve a blueprint in JSON format.

Path Parameters

  • blueprint_id: UUID. Blueprint ID. Required.

Response

Retrieve blueprint

Unauthorized

Forbidden, insufficient privileges

Blueprint not found

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

blueprint_id = 1234
blueprint = cloudcraft.read_blueprint(blueprint_id)

Update a blueprint

PUT  /blueprint/{blueprint_id}

Overview

Update an existing blueprint.

The body of the request should contain the updated blueprint document in JSON format.

Optionally, a conditional update of the blueprint can be perfomed by including the If-Match HTTP header with the same ETag value as provided by the “Retrieve blueprint” API. If the blueprint has been modified since the retrieval, the update is rejected with a 412 Resource out of date response. If the update succeeds, the new ETag is returned.

Response

OK

Unauthorized

Forbidden, insufficient privileges

Blueprint not found

Resource out of date

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

blueprint_id = 1234
data = {
    "data": {
        "grid": "standard",
        "name": "Updated blueprint",
        "text": [
            {
                "id": "label1",
                "text": "Hello\nWorld!",
                "type": "isotext",
                "color": "#f5b720",
                "mapPos": [0, 0],
                "textSize": 15,
            }
        ],
    }
}
result = cloudcraft.update_blueprint(blueprint_id, data)

Export a blueprint as an image

GET  /blueprint/{blueprint_id}/{format}

Overview

Render blueprint for export in SVG, PNG, PDF, or MxGraph format.

Path Parameters

  • blueprint_id: UUID. Blueprint ID.
  • format: String. One of “svg”, “png”, “pdf”, or “mxGraph”.

Optional query parameters

  • scale: Float. Scale relative to original size (1.0), for example, 0.5 for half or 2.0 for double size.
  • width: Number. Image width in pixels (for SVG, PNG, and PDF).
  • height: Number. Image height in pixels (for SVG, PNG, and PDF).
  • grid: Boolean. Enable or disable grid rendering.
  • transparent: Boolean. Enable or disable transparent background rendering.
  • landscape: Boolean. Enable or disable landscape paper format (PDF).
  • paperSize: String. One of “Letter”, “Legal”, “Tabloid”, “Ledger”, “A0”, “A1”, “A2”, “A3”, “A4”, “A5”.

Response

OK

Unauthorized

Forbidden, insufficient privileges

Blueprint not found

Code Example

from cloudcraftco import Cloudcraft

cloudcraft = Cloudcraft()

blueprints = cloudcraft.list_blueprints()

blueprint_id = 1234
bp_format = "png"
export = cloudcraft.export_blueprint(blueprint_id, bp_format)
with open(f'export.{bp_format}', "wb") as binary_file:
    binary_file.write(export)

PREVIEWING: brett.blue/add-otel-integrations