Skip to main content

Document

A document item places a document file on the project map. Documents are automatically converted for rendering. Document creation requires a multipart file upload.

Item type: document

Properties​

PropertyTypeRequiredUpdatableDefaultDescription
positionobjectNoYes{ x: 0, y: 0 }Position with x and y fields.
sizeobjectYesYes—Size with width and height fields. Min 5 per dimension.
scalenumberNoYes1Scale factor. Must be > 0.
anglenumberNoYes0Rotation angle (0–360).
fileNamestringYesYes—Original file name. Max 128 characters, no path separators (/, \).
mimeTypestringYesYes—MIME type of the file. See Supported MIME Types.
fileSizenumberYesYes—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 TypeFormat
application/pdfPDF
application/mswordMicrosoft Word (.doc)
application/vnd.openxmlformats-officedocument.wordprocessingml.documentMicrosoft Word (.docx)
application/vnd.ms-powerpointMicrosoft PowerPoint (.ppt)
application/vnd.openxmlformats-officedocument.presentationml.presentationMicrosoft PowerPoint (.pptx)
application/rtfRich Text Format
application/vnd.oasis.opendocument.presentationOpenDocument Presentation (.odp)
application/vnd.oasis.opendocument.textOpenDocument Text (.odt)

Create (File Upload)​

Creates a new document item with file upload. This is the recommended method.

POST /api/v2/projects/{projectId}/item/{parent}/document/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 document file.

curl​

curl -X POST "https://api.deon.cloud/api/v2/projects/{projectId}/item/inbox/document/file" \
-H "Authorization: Bearer <token>" \
-F 'dataobject={
"position": { "x": 50, "y": 50 },
"size": { "width": 800, "height": 600 }
}' \
-F "binary=@/path/to/report.pdf"

JavaScript​

const formData = new FormData();

formData.append(
"dataobject",
JSON.stringify({
position: { x: 50, y: 50 },
size: { width: 800, height: 600 },
})
);

formData.append("binary", fileInput.files[0]);

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/inbox/document/file`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
body: formData,
}
);

const data = await response.json();
console.log(data.itemId);

Response​

{
"itemId": "f6a7b8c9-d0e1-2345-fabc-456789012345"
}

Update​

Updates an existing document item's properties. File content cannot be changed via update.

PATCH /api/v2/projects/{projectId}/item/document/{itemId}

curl​

curl -X PATCH "https://api.deon.cloud/api/v2/projects/{projectId}/item/document/{itemId}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"position": { "x": 100, "y": 100 },
"angle": 90
}'

JavaScript​

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/document/${itemId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
position: { x: 100, y: 100 },
angle: 90,
}),
}
);

const data = await response.json();
console.log(data.itemId);

Response​

{
"itemId": "f6a7b8c9-d0e1-2345-fabc-456789012345"
}