Skip to content

Anchors API

The anchors API operates on anchors on a canvas.

List Anchors

Gets all anchors of the specified canvas.

GET /canvases/:id/anchors

Attribute Type Required Description


id (path) uuid yes ID of the canvas subscribe (query) boolean no See api_streaming

curl -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/09348962-32aa-480d-b3d6-cacef4030ac2/anchors

Example response:

[
  {
    "anchor_index": 0,
    "anchor_name": "New anchor",
    "depth": 0,
    "id": "5da69125-a5f5-417d-8d8d-a633a0499560",
    "location": {
      "x": 4676.818359375,
      "y": 2432.80126953125
    },
    "parent_id": "08596c44-389c-45d6-9f32-a9940c54b7d9",
    "pinned": false,
    "scale": 1,
    "size": {
      "height": 800,
      "width": 1200
    },
    "state": "normal",
    "widget_type": "Anchor"
  }
]

Single Anchor

Gets a single anchor.

GET /canvases/:id/anchors/:anchor_id

Attribute Type Required Description


id (path) uuid yes ID of the canvas anchor_id (path) uuid yes ID of the anchor to get subscribe (query) boolean no See api_streaming

curl -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/09348962-32aa-480d-b3d6-cacef4030ac2/anchors/5da69125-a5f5-417d-8d8d-a633a0499560

Example response:

{
  "anchor_index": 0,
  "anchor_name": "New anchor",
  "depth": 0,
  "id": "5da69125-a5f5-417d-8d8d-a633a0499560",
  "location": {
    "x": 4676.818359375,
    "y": 2432.80126953125
  },
  "parent_id": "08596c44-389c-45d6-9f32-a9940c54b7d9",
  "pinned": false,
  "scale": 1,
  "size": {
    "height": 800,
    "width": 1200
  },
  "state": "normal",
  "widget_type": "Anchor"
}

Create Anchor

Creates an anchor.

POST /canvases/:id/anchors

Attribute Type Required Description


id (path) uuid yes ID of the canvas depth number no Depth of the anchor compared to its siblings location object no Location of the anchor relative to its parent pinned boolean no Is the anchor pinned or not scale number no Scale of the anchor size object no Size of the anchor anchor_index number no Index number of the anchor anchor_name string no Name of the anchor

curl -X POST -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/09348962-32aa-480d-b3d6-cacef4030ac2/anchors

Example response:

{
  "anchor_index": 1,
  "anchor_name": "New anchor",
  "depth": 0,
  "id": "8cf37672-e642-449d-881e-6ee6e42afc16",
  "location": {
    "x": 4632.12841796875,
    "y": 3039.445556640625
  },
  "parent_id": "08596c44-389c-45d6-9f32-a9940c54b7d9",
  "pinned": false,
  "scale": 1,
  "size": {
    "height": 800,
    "width": 1200
  },
  "state": "normal",
  "widget_type": "Anchor"
}

Update Anchor

Updates an anchor.

PATCH /canvases/:id/anchors/:anchor_id

Attribute Type Required Description


id (path) uuid yes ID of the canvas anchor_id (path) uuid yes ID of the anchor to update depth number no Depth of the anchor compared to its siblings location object no Location of the anchor relative to its parent pinned boolean no Is the anchor pinned or not scale number no Scale of the anchor size object no Size of the anchor anchor_index number no Index number of the anchor anchor_name string no Name of the anchor

curl -X PATCH -H "Private-Token: <access token>" -d '{"anchor_name":"Region 1"}' https://canvus.example.com/api/v1/canvases/09348962-32aa-480d-b3d6-cacef4030ac2/anchors/5da69125-a5f5-417d-8d8d-a633a0499560

Example response:

{
  "anchor_index": 0,
  "anchor_name": "Region 1",
  "depth": 0,
  "id": "5da69125-a5f5-417d-8d8d-a633a0499560",
  "location": {
    "x": 4676.818359375,
    "y": 2432.80126953125
  },
  "parent_id": "08596c44-389c-45d6-9f32-a9940c54b7d9",
  "pinned": false,
  "scale": 1,
  "size": {
    "height": 800,
    "width": 1200
  },
  "state": "normal",
  "widget_type": "Anchor"
}

Delete Anchor

Deletes an anchor.

DELETE /canvases/:id/anchors/:anchor_id

Attribute Type Required Description


id (path) uuid yes ID of the canvas anchor_id (path) uuid yes ID of the anchor to delete

curl -X DELETE -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/09348962-32aa-480d-b3d6-cacef4030ac2/anchors/5da69125-a5f5-417d-8d8d-a633a0499560