SVG
An SVG item places a vector image on the project map. SVG creation requires a multipart file upload.
Item type: svg
Properties
| Property | Type | Required | Updatable | Default | Description |
|---|---|---|---|---|---|
position | object | No | Yes | { x: 0, y: 0 } | Position with x and y fields. |
size | object | Yes | Yes | — | Size with width and height fields. Min 5 per dimension. |
scale | number | No | Yes | 1 | Scale factor. Must be > 0. |
angle | number | No | Yes | 0 | Rotation angle (0–360). |
fileName | string | Yes | Yes | — | Original file name. Max 128 characters, no path separators (/, \). |
mimeType | string | Yes | Yes | — | Must be image/svg+xml. |
fileSize | number | Yes | Yes | — | File size in bytes. |
info
When using the file upload endpoint, fileName, mimeType, and fileSize are automatically populated from the uploaded file.
Supported MIME Types
| MIME Type | Format |
|---|---|
image/svg+xml | SVG |
Create (File Upload)
Creates a new SVG item with file upload. This is the recommended method.
POST /api/v2/projects/{projectId}/item/{parent}/svg/file
Content-Type: multipart/form-data
The request must be sent as multipart/form-data with two parts:
dataobject: JSON string with the item properties.binary: The SVG file.
curl
curl -X POST "https://api.deon.cloud/api/v2/projects/{projectId}/item/inbox/svg/file" \
-H "Authorization: Bearer <token>" \
-F 'dataobject={
"position": { "x": 150, "y": 250 },
"size": { "width": 300, "height": 300 }
}' \
-F "binary=@/path/to/icon.svg"
JavaScript
const formData = new FormData();
formData.append(
"dataobject",
JSON.stringify({
position: { x: 150, y: 250 },
size: { width: 300, height: 300 },
})
);
formData.append("binary", fileInput.files[0]);
const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/inbox/svg/file`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
body: formData,
}
);
const data = await response.json();
console.log(data.itemId);
Response
{
"itemId": "a7b8c9d0-e1f2-3456-abcd-567890123456"
}
Update
Updates an existing SVG item's properties. File content cannot be changed via update.
PATCH /api/v2/projects/{projectId}/item/svg/{itemId}
curl
curl -X PATCH "https://api.deon.cloud/api/v2/projects/{projectId}/item/svg/{itemId}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"position": { "x": 300, "y": 400 },
"scale": 1.5
}'
JavaScript
const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/svg/${itemId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
position: { x: 300, y: 400 },
scale: 1.5,
}),
}
);
const data = await response.json();
console.log(data.itemId);
Response
{
"itemId": "a7b8c9d0-e1f2-3456-abcd-567890123456"
}