Skip to main content

Shape

A shape is a geometric element on the project map with configurable type, fill, and stroke.

Item type: shape

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).
typestringNoNo"Rectangle"Shape type. Immutable after creation. See Shape Types.
fillColorstringNoYesTransparentFill color as a hex string: "#RRGGBB", "#AARRGGBB" (alpha first) or "#RGB"; CSS forms such as rgb() and named colors are rejected.
strokeColorstringNoYes"#FFFFFF"Stroke (border) color as a hex string: "#RRGGBB", "#AARRGGBB" (alpha first) or "#RGB"; CSS forms such as rgb() and named colors are rejected.
strokeThicknessnumberNoYes2Stroke width in pixels. Must be ≥ 0.
adjustmentValuesnumber[]NoYes[]Shape-specific adjustment values. Each value must be ≥ 0.
cornerRadiusnumberNoYesThe shape's ownCorner radius in world units, for the round-corner shapes only. Must be ≥ 0. See Corner Radius.
warning

The type property is immutable — it can only be set during creation and cannot be changed via update.

Corner Radius​

cornerRadius sets rounded corners in world units, so shapes of different sizes get the same corners. It applies to the shapes below; any other shape rejects it.

TypeCorners it rounds
RoundedRectangleall four (default: a tenth of the shorter side)
OneRoundCornerRectangletop-right
TwoSameSideRoundCornerRectangleboth top corners
TwoDiagonalRoundCornerRectangletop-left and bottom-right
OneSnipOneRoundCornerRectangletop-left
  • The server stores it as the first of adjustmentValues, a fraction of the shorter side of the drawn shape (size times scale). When a request sends both, cornerRadius wins over that first value and the others are kept.
  • The radius is capped at half the shorter side, where a RoundedRectangle becomes a pill.
  • An update converts it at the size and scale sent in the same request, or else at the ones the shape has.
  • A later size change scales the corners with the shape. To resize and keep the corners, send size and cornerRadius in the same PATCH.
  • GET returns the radius the corners are drawn with. It is null for other shapes.

Shape Types​

The following shape types are supported (case-insensitive):

TypeDescription
RectangleStandard rectangle
EllipseEllipse / circle
RoundedRectangleRectangle with rounded corners
TriangleEquilateral triangle
RightTriangleRight-angled triangle
DiamondDiamond / rhombus
HexagonRegular hexagon
HeptagonRegular heptagon
OctagonRegular octagon
DecagonRegular decagon
DodecagonRegular dodecagon
PentagonRegular pentagon
ParallelogramParallelogram
TrapezoidTrapezoid
PlusPlus / cross shape
DonutRing / donut shape
HeartHeart shape
LightningBoltLightning bolt
Star44-pointed star
Star55-pointed star
Star66-pointed star
DirectionArrowBidirectional arrow
DirectionArrowRightRight-pointing direction arrow
DirectionArrowLeftLeft-pointing direction arrow
RightArrowRight arrow
LeftArrowLeft arrow
UpArrowUp arrow
DownArrowDown arrow
LeftRightArrowLeft-right arrow
UpDownArrowUp-down arrow
QuadArrowFour-directional arrow
LeftRightUpArrowLeft-right-up arrow
StripedRightArrowStriped right arrow
NotchedRightArrowNotched right arrow
PlaquePlaque shape
FrameFrame shape
HalfFrameHalf-frame shape
CornerCorner shape
OneSnipCornerRectangleRectangle with one snipped corner
TwoSameSideSnipCornerRectangleRectangle with two same-side snipped corners
TwoDiagonalSnipCornerRectangleRectangle with two diagonal snipped corners
OneSnipOneRoundCornerRectangleRectangle with one snipped and one rounded corner
OneRoundCornerRectangleRectangle with one rounded corner
TwoSameSideRoundCornerRectangleRectangle with two same-side rounded corners
TwoDiagonalRoundCornerRectangleRectangle with two diagonal rounded corners

Create​

Creates a new shape item in the project.

POST /api/v2/projects/{projectId}/item/{parent}/shape

curl​

curl -X POST "https://api.deon.cloud/api/v2/projects/{projectId}/item/inbox/shape" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"type": "Ellipse",
"position": { "x": 200, "y": 300 },
"size": { "width": 150, "height": 150 },
"fillColor": "#4CAF50",
"strokeColor": "#2E7D32",
"strokeThickness": 3
}'

JavaScript​

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/inbox/shape`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "Ellipse",
position: { x: 200, y: 300 },
size: { width: 150, height: 150 },
fillColor: "#4CAF50",
strokeColor: "#2E7D32",
strokeThickness: 3,
}),
}
);

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

Response​

{
"itemId": "c3d4e5f6-a7b8-9012-cdef-123456789012"
}

Update​

Updates an existing shape. Only include the properties you want to change. The type property cannot be updated.

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

curl​

curl -X PATCH "https://api.deon.cloud/api/v2/projects/{projectId}/item/shape/{itemId}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"fillColor": "#FF9800",
"strokeThickness": 5
}'

JavaScript​

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/shape/${itemId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
fillColor: "#FF9800",
strokeThickness: 5,
}),
}
);

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

Response​

{
"itemId": "c3d4e5f6-a7b8-9012-cdef-123456789012"
}

Read​

GET /api/v2/projects/{projectId}/item/{itemId} returns the shape with every property above. For a round-corner shape cornerRadius is the radius its corners are drawn with; GET /api/v2/projects/{projectId}/item/{itemId}/cornerRadius returns just that number. An excerpt of the response:

{
"type": "RoundedRectangle",
"position": { "x": 200, "y": 300 },
"size": { "width": 1500, "height": 1500 },
"adjustmentValues": [0.04933333333333333],
"cornerRadius": 74
}