Images API
The images API operates on images on a canvas.
List Images
Gets all images of the specified canvas.
GET /canvases/:id/images
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/c3d319c2-5eed-456d-acbb-8da46e788157/images
Example response:
[
{
"depth": 0,
"hash": "cbcb439a796b",
"id": "40a30897-57ea-4c35-9bf8-64db7fc710e0",
"location": {
"x": 5130.68212890625,
"y": 2164.9775390625
},
"original_filename": "",
"parent_id": "aad4f204-2324-401e-9acf-257d2dad4d99",
"pinned": false,
"scale": 1,
"size": {
"height": 100,
"width": 100
},
"state": "normal",
"title": "A dog",
"widget_type": "Image"
}
]
Single Image
Gets a single image.
GET /canvases/:id/images/:image_id
Attribute Type Required Description
id (path) uuid yes ID of the canvas
image_id (path) uuid yes ID of the image to get
subscribe (query) boolean no See api_streaming
curl -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/c3d319c2-5eed-456d-acbb-8da46e788157/images/40a30897-57ea-4c35-9bf8-64db7fc710e0
Example response:
{
"depth": 0,
"hash": "cbcb439a796b",
"id": "40a30897-57ea-4c35-9bf8-64db7fc710e0",
"location": {
"x": 5130.68212890625,
"y": 2164.9775390625
},
"original_filename": "",
"parent_id": "aad4f204-2324-401e-9acf-257d2dad4d99",
"pinned": false,
"scale": 1,
"size": {
"height": 100,
"width": 100
},
"state": "normal",
"title": "A dog",
"widget_type": "Image"
}
Download Image
Downloads a single image.
GET /canvases/:id/images/:image_id/download
Attribute Type Required Description
id (path) uuid yes ID of the canvas
image_id (path) uuid yes ID of the image to get
curl -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/c3d319c2-5eed-456d-acbb-8da46e788157/images/40a30897-57ea-4c35-9bf8-64db7fc710e0/download
Create Image
Creates an image. The request must be a multipart POST request with an optional json and mandatory data part.
POST /canvases/:id/images
Attribute Type Required Description
id (path) uuid yes ID of the canvas
depth number no Depth of the image compared to its siblings
location object no Location of the image relative to its parent
parent_id uuid no ID of the image\'s parent
pinned boolean no Is the image pinned or not
scale number no Scale of the image
size object no Size of the image
original_filename string no Original filename of the image
title string no Title of the image
curl -X POST -H "Private-Token: <access token>" -F 'json={"title":"A dog"}' -F 'data=@dog.jpg' https://canvus.example.com/api/v1/canvases/c3d319c2-5eed-456d-acbb-8da46e788157/images
Example response:
{
"depth": 0,
"hash": "",
"id": "0b79a537-e9a6-4733-9610-a4066f49e01f",
"location": {
"x": 5226.29150390625,
"y": 2666.8251953125
},
"original_filename": "",
"parent_id": "aad4f204-2324-401e-9acf-257d2dad4d99",
"pinned": false,
"scale": 1,
"size": {
"height": 100,
"width": 100
},
"state": "normal",
"title": "A dog",
"widget_type": "Image"
}
Update Image
Updates an image.
PATCH /canvases/:id/images/:image_id
Attribute Type Required Description
id (path) uuid yes ID of the canvas
image_id (path) uuid yes ID of the image to update
depth number no Depth of the image compared to its siblings
location object no Location of the image relative to its parent
parent_id uuid no ID of the image\'s parent
pinned boolean no Is the image pinned or not
scale number no Scale of the image
size object no Size of the image
original_filename string no Original filename of the image
title string no Title of the image
curl -X PATCH -H "Private-Token: <access token>" -d '{"pinned":true}' https://canvus.example.com/api/v1/canvases/c3d319c2-5eed-456d-acbb-8da46e788157/images/40a30897-57ea-4c35-9bf8-64db7fc710e0
Example response:
{
"depth": 0,
"hash": "cbcb439a796b",
"id": "40a30897-57ea-4c35-9bf8-64db7fc710e0",
"location": {
"x": 5130.68212890625,
"y": 2164.9775390625
},
"original_filename": "",
"parent_id": "aad4f204-2324-401e-9acf-257d2dad4d99",
"pinned": true,
"scale": 1,
"size": {
"height": 100,
"width": 100
},
"state": "normal",
"title": "A dog",
"widget_type": "Image"
}
Delete Image
Deletes an image.
DELETE /canvases/:id/images/:image_id
Attribute Type Required Description
id (path) uuid yes ID of the canvas
image_id (path) uuid yes ID of the image to delete
curl -X DELETE -H "Private-Token: <access token>" https://canvus.example.com/api/v1/canvases/c3d319c2-5eed-456d-acbb-8da46e788157/images/40a30897-57ea-4c35-9bf8-64db7fc710e0