Scene API
Action¶
Add an action¶
Url: POST /scene/action
Body¶
| Name | Type | Description |
|---|---|---|
| label | Object | The label of the action to be displayed in the UI. |
| name | String | The name of the action. Must be unique per file. |
| icon | String | The icon to be associated with the action (will be displayed in the UI). This icon should be one of Material Design. (optional) |
| matchQuery | String | A query to filter the nodes matched by this Action. (optional) |
| enabledQuery | String | A query to determine if the Action can be triggered by the users. (optional) |
| undoableQuery | String | A query to determine if the Action can be undone by the users. (optional) |
| files | String[] | The ID of the Files this Action is attached to. Empty array if this Action is global (shared by all existing Files). (optional) |
| readPermissions | String[] | An array of the permissions needed to have read access to the action. (optional) |
| writePermissions | String[] | An array of the permissions needed to have write access to the action. (optional) |
Success 200¶
| Name | Type | Description |
|---|---|---|
| object | Object | The action created. |
Success-Response:
Example usage:
curl -X POST 'https://smartshape.io/scene/action' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
--data '{
"label": {
"en_US": "Previous",
"fr_FR": "Précédent"
},
"name": "Test name",
"icon": "square",
"matchQuery": "cube",
"files": ["62f1149ddcdc5f002ee5bbaa"],
"readPermissions": [],
"writePermissions": []
}'
List actions.¶
Url: GET /scene/action/:fileId
Parameter¶
| Name | Type | Description |
|---|---|---|
| fileId | String | optional The id of the file to list actions on (optional). |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | boolean | |
| actions | String | The actions of the file |
Success-Response:
Example usage:
Remove action¶
Url: DELETE /scene/action/:action
Parameter¶
| Name | Type | Description |
|---|---|---|
| action | String | Action id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | boolean | |
| action | String | The action id deleted |
Example usage:
Revert an action.¶
Url: POST /action/revert/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | The id of the file on which the action is triggered. |
Body¶
| Name | Type | Description |
|---|---|---|
| nodeIds | String[] | The nodes on which the action will be reverted. |
| actionId | String | The id of the action to revert. |
| activeConfigurationId | String | optional The id of the active Configuration. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | boolean |
Example usage:
curl -X PUT 'https://smartshape.io/scene/action/revert/6364e71370fccd0034e0720c' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
--data '{
"nodeIds": ["f432d3c929e5c6aeed079bf3"],
"actionId": "6089543988bb2e000be0092e",
"activeConfigurationId": "9543988bb2608e000be0092e"
}'
Trigger an action.¶
Url: POST /action/trigger/:fileId
Parameter¶
| Name | Type | Description |
|---|---|---|
| fileId | String | The id of the file on which the action is triggered. |
Body¶
| Name | Type | Description |
|---|---|---|
| nodeIds | String[] | The nodes on which the action will be triggered. |
| actionId | String | The id of the action to trigger. |
| activeConfigurationId | String | optional The id of the active Configuration. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | boolean |
Example usage:
curl -X PUT 'https://smartshape.io/scene/action/trigger/6364e71370fccd0034e0720c' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
--data '{
"nodeIds": ["f432d3c929e5c6aeed079bf3"],
"actionId": "6089543988bb2e000be0092e",
"activeConfigurationId": "9543988bb2608e000be0092e"
}'
ClippingBox¶
Create a Clipping Box¶
Url: POST /scene/clipping-box/
Body¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| name | String | Name of the clipping box |
| colorId | Number | Id of the color of the clipping box |
| offset | Number | Offset applied outward to each side of the box. Defaults to 0.0. |
| equations | Object[] | Equations of the planes forming each side of the clipping box, it must contain exactly 6 elements |
| equations.x | Number | x coordinate of the normal of the plane |
| equations.y | Number | y coordinate of the normal of the plane |
| equations.z | Number | z coordinate of the normal of the plane |
| equations.w | Number | distance from the origin of the plane |
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | Id of the created Clipping Box |
| file | String | File id |
| name | String | Name of the clipping box |
| colorId | Number | Id of the color of the clipping box |
| equations | Object[] | Equations of the planes forming each side of the clipping box, it must contain exactly 6 elements |
| equations.x | Number | x coordinate of the normal of the plane |
| equations.y | Number | y coordinate of the normal of the plane |
| equations.z | Number | z coordinate of the normal of the plane |
| equations.w | Number | distance from the origin of the plane |
Success-Response:
HTTP/1.1 200 OK
{
"id": "5b7e9cd04b121441d67c4bac",
"file": "5b72a7eb74f4ab7d20ef6f74",
"name": "First clipping box",
"colorId": 0,
"equations": [{
"x": 1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
{
"x": -1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": -1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": -1,
"w": 0.5
}
]
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Not Found |
|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/clipping-box/ \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "First clipping box",
"colorId": 0,
"equations": [{
"x": 1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
{
"x": -1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": -1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": -1,
"w": 0.5
}
]
}'
Delete a Clipping Box¶
Url: DELETE /scene/clipping-box/:clippingBox
Parameter¶
| Name | Type | Description |
|---|---|---|
| clippingBox | String | Id of the ClippingBox to delete |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Error-Response:
Example usage:
List clipping boxes¶
Url: GET /scene/clipping-box/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the clipping boxes that belong to the specified file |
| body.id | String | Id of the Clipping Box |
| body.file | String | File id |
| body.name | String | Name of the clipping box |
| body.colorId | Number | Id of the color of the clipping box |
| body.offset | Number | Offset applied outward to each side of the box |
| body.equations | Object[] | Equations of the planes forming each side of the clipping box, it must contain exactly 6 elements |
| body.equations.x | Number | x coordinate of the normal of the plane |
| body.equations.y | Number | y coordinate of the normal of the plane |
| body.equations.z | Number | z coordinate of the normal of the plane |
| body.equations.w | Number | distance from the origin of the plane |
Success-Response:
HTTP/1.1 200 OK
[
{
"id": "5b7e9cd04b121441d67c4bac",
"file": "5b72a7eb74f4ab7d20ef6f74",
"name": "First clipping box",
"colorId": 0,
"equations": [{
"x": 1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
{
"x": -1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": -1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": -1,
"w": 0.5
}
]
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Update a Clipping Box¶
Url: PUT /scene/clipping-box/:clippingBox
Parameter¶
| Name | Type | Description |
|---|---|---|
| clippingBox | String | Id of the ClippingBox to update |
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | optional Name of the clipping box |
| colorId | Number | optional The id of the color of the clipping box |
| offset | Number | optional Offset applied outward to each side of the box |
| equations | Object[] | optional Equations of the planes forming each side of the clipping box, it must contain exactly 6 elements |
| equations.x | Number | x coordinate of the normal of the plane |
| equations.y | Number | y coordinate of the normal of the plane |
| equations.z | Number | z coordinate of the normal of the plane |
| equations.w | Number | distance from the origin of the plane |
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | Id of the updated Clipping Box |
| file | String | File id |
| name | String | Name of the clipping box |
| colorId | Number | Id of the color of the clipping box |
| equations | Object[] | Equations of the planes forming each side of the clipping box, it must contain exactly 6 elements |
| equations.x | Number | x coordinate of the normal of the plane |
| equations.y | Number | y coordinate of the normal of the plane |
| equations.z | Number | z coordinate of the normal of the plane |
| equations.w | Number | distance from the origin of the plane |
Success-Response:
HTTP/1.1 200 OK
{
"id": "5b7e9cd04b121441d67c4bac",
"file": "5b72a7eb74f4ab7d20ef6f74",
"name": "First clipping box",
"colorId": 0,
"equations": [{
"x": 1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
{
"x": -1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": -1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": -1,
"w": 0.5
}
]
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Not Found |
|
| 500 | Internal Error |
Example usage:
curl -X PUT \
https://smartshape.io/scene/clipping-box/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "First clipping box"
}'
curl -X PUT \
https://smartshape.io/scene/clipping-box/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"equations": [{
"x": 1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
{
"x": -1,
"y": 0,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": -1,
"z": 0,
"w": 0.5
},
{
"x": 0,
"y": 0,
"z": -1,
"w": 0.5
}
]
}'
ClippingPlane¶
Create or update clipping plane(s)¶
Url: POST /scene/clipping-plane/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of clipping planes to create or update. |
| clipping-plane.name | String | The name of the clipping plane |
| clipping-plane.colorId | Number | The id of the color used for the clipping plane |
| clipping-plane.equation | Object | Equation of the clipping plane surface |
| clipping-plane.equation.x | Number | x value of the equation |
| clipping-plane.equation.y | Number | y value of the equation |
| clipping-plane.equation.z | Number | z value of the equation |
| clipping-plane.equation.w | Number | distance value of the equation |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the created or updated clipping plane(s) |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "First clipping plane",
"colorId": 0,
"equation": {
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bac"
},
{
"name": "Second clipping plane",
"colorId": 1,
"equation": {
"x": 0,
"y": 1,
"z": 0,
"w": 10
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bad"
}
]
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Not Found |
|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/clipping-plane/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '[{
"name": "First clipping plane",
"colorId": 0,
"equation": {
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
}
}, {
"name": "Second clipping plane",
"colorId": 1,
"equation": {
"x": 0,
"y": 1,
"z": 0,
"w": 10
}
}]'
curl -X POST \
https://smartshape.io/scene/clipping-plane/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '[{
"_id", "5b7e9cd04b121441d67c4bad",
"name": "Updated clipping plane name",
"colorId": 4,
"equation": {
"x": 2,
"y": 2,
"z": 1,
"w": 0.5
}
}]'
Delete clipping plane(s)¶
Url: DELETE /scene/clipping-plane/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| body | String[] | Array of clipping planes id to delete. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the removed clipping plane(s) |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "First clipping plane",
"colorId": 0,
"equation": {
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bac"
},
{
"name": "Second clipping plane",
"colorId": 1,
"equation": {
"x": 0,
"y": 1,
"z": 0,
"w": 10
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bad"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Could not find clipping plane |
|
| 500 | Internal Error |
Example usage:
List clipping plane(s)¶
Url: GET /scene/clipping-plane/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| Array | Object[] | of the clipping plane(s) to add or update |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the clipping plane(s) that belongs to the specified file |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "First clipping plane",
"colorId": 0,
"equation": {
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bac"
},
{
"name": "Second clipping plane",
"colorId": 1,
"equation": {
"x": 0,
"y": 1,
"z": 0,
"w": 10
},
"file": "5b72a7eb74f4ab7d20ef6f74",
"id": "5b7e9cd04b121441d67c4bad"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Layer¶
Add a node to a layer¶
Url: POST /scene/layer/:file/:layer/:nodeId
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
| nodeId | String | Id of the node to add to the layer |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Add nodes to a layer¶
Url: POST /scene/layer/:file/:layer/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
Body¶
| Name | Type | Description |
|---|---|---|
| nodes | String | List of nodes, separated by ";" |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Add query result to layer¶
Url: POST /scene/layer/:file/:layer/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
Body¶
| Name | Type | Description |
|---|---|---|
| variables | Object | optional Search variables |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Create a layer¶
Url: POST /scene/layer/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Layer name |
| color | Number | Color palette index |
| order | Number | optional Value used to sort layers when listed |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean | Whether the request was successful or not. |
| data | Object | Object containing information about the layer. |
| data.file | String | ID of the file the layer is in. |
| data.name | String | Name of the layer. |
| data.color | Number | Color palette index of the layer. |
| data.permissions | Object | Object containing permissions for the layer. |
| data.permissions._id | String | ID of the permissions. |
| data.permissions.removeNode | Array | Permissions required to remove Nodes. |
| data.permissions.addNode | Array | Permissions required to add Nodes. |
| data.permissions.delete | Array | Permissions required to delete the layer. |
| data.permissions.writeFolders | Array | Permissions required to modify the |
| data.permissions.readFolders | Array | Permissions required to read the |
| data.permissions.writeOrder | Array | Permissions required to modify the |
| data.permissions.readOrder | Array | Permissions required to read the |
| data.permissions.writeColor | Array | Permissions required to modify the |
| data.permissions.readColor | Array | Permissions required to read the |
| data.permissions.writeName | Array | Permissions required to modify the |
| data.permissions.readName | Array | Permissions required to read the |
| data.writePermissions | Array | Permissions required to modify the layer. |
| data.readPermissions | Array | Permissions required to read the layer. |
| data.folders | Array | Array of folders the layer is in. |
| data.order | Number | Order of the layer. |
| data.id | String | ID of the layer. |
Success-Response:
HTTP/1.1 200 OK
{
"file": "628299cad62e88002e79e743",
"name": "Layer 1",
"color": 1,
"permissions": {
"_id": "628299d2e2e755002e283d1a",
"removeNode": [],
"addNode": [],
"delete": [],
"writeFolders": [],
"readFolders": [],
"writeOrder": [],
"readOrder": [],
"writeColor": [],
"readColor": [],
"writeName": [],
"readName": []
},
"writePermissions": [],
"readPermissions": [],
"folders": [],
"order": 0,
"id": "628299d2e2e755002e283d1b"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Delete a layer¶
Url: DELETE /scene/layer/:file/:layer
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Get surface colors¶
Url: GET /scene/layer/colors/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List layers¶
Url: GET /scene/layer/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| data | Object | Layer list |
Success-Response:
HTTP/1.1 200 OK
{
"data":[
{
"type": "layer",
"id": "5ea82eb367cca75e0538bc0f",
"attributes": {
"file": "5ea816bcf6e1314e9abef5c2",
"name": "Test Layer",
"color": 0,
"permissions": {
"_id": "5ea82eb367cca75e0538bc10",
"removeNode": [],
"addNode": [],
"delete": [],
"writeFolders": [],
"readFolders": [],
"writeOrder": [],
"readOrder": [],
"writeColor": [],
"readColor": [],
"writeName": [],
"readName": []
},
"writePermissions": [],
"readPermissions": [],
"folders": [],
"order": 2,
"__v": 0
}
}
]
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List node layers¶
Url: GET /scene/layers/:file/:nodeId
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| nodeId | String | Node id or uuid |
Success 200¶
| Name | Type | Description |
|---|---|---|
| node | Object | Root node |
| children | Array | Root node children |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Remove a node from a layer¶
Url: DELETE /scene/layer/:file/:layer/:nodeId
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
| nodeId | String | Id of the node to add to the layer |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Error-Response:
Example usage:
Update a layer¶
Url: POST /scene/layer/update/:file/:layer
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| layer | String | Layer id |
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | optional Layer name |
| color | Number | optional Color palette index |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean | Whether the request was successful or not. |
| data | Object | Object containing information about the layer. |
| data.file | String | ID of the file the layer is in . |
| data.name | String | Name of the layer. |
| data.color | Number | Color palette index of the layer. |
| data.permissions | Object | Object containing permissions for the layer. |
| data.permissions._id | String | ID of the permissions. |
| data.permissions.removeNode | Array | Permissions required to remove Nodes. |
| data.permissions.addNode | Array | Permissions required to add Nodes. |
| data.permissions.delete | Array | Permissions required to delete the layer. |
| data.permissions.writeFolders | Array | Permissions required to modify the |
| data.permissions.readFolders | Array | Permissions required to read the |
| data.permissions.writeOrder | Array | Permissions required to modify the |
| data.permissions.readOrder | Array | Permissions required to read the |
| data.permissions.writeColor | Array | Permissions required to modify the |
| data.permissions.readColor | Array | Permissions required to read the |
| data.permissions.writeName | Array | Permissions required to modify the |
| data.permissions.readName | Array | Permissions required to read the |
| data.writePermissions | Array | Permissions required to modify the layer. |
| data.readPermissions | Array | Permissions required to read the layer. |
| data.folders | Array | Array of folders the layer is in. |
| data.order | Number | Order of the layer. |
| data.id | String | ID of the layer. |
Success-Response:
HTTP/1.1 200 OK
{
"success": true,
"data": {
"file": "628299cad62e88002e79e743",
"name": "Layer 1",
"color": 1,
"permissions": {
"_id": "628299d2e2e755002e283d1a",
"removeNode": [],
"addNode": [],
"delete": [],
"writeFolders": [],
"readFolders": [],
"writeOrder": [],
"readOrder": [],
"writeColor": [],
"readColor": [],
"writeName": [],
"readName": []
},
"writePermissions": [],
"readPermissions": [],
"folders": [],
"order": 0,
"id": "628299d2e2e755002e283d1b"
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
NodeMetadata¶
Create a NodeMetadata¶
Url: POST /scene/node/metadata/
Body¶
| Name | Type | Description |
|---|---|---|
| files | String[] | The file ids this NodeMetadata is attached to. Must contain at least one element. |
| matchQuery | String | optional SmartShapeQL query that:
|
| tooltipQuery | String | optional SmartShapeQL query that:
|
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | The ID of the created NodeMetadata |
| files | String[] | The file ids this NodeMetadata is attached to. Must contain at least one element. |
| matchQuery | String | optional SmartShapeQL query that:
|
| tooltipQuery | String | optional SmartShapeQL query that:
|
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/node/metadata \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"files": ["5de644b4bddb28460ef34400"],
"matchQuery": "test",
"tooltipQuery": "join(array(get(., \"name\"), \" is attached to an object made of \", @\"material\"))"
}'
Delete a NodeMetadata¶
Url: DELETE /scene/node/metadata/:nodeMetadata
Parameter¶
| Name | Type | Description |
|---|---|---|
| nodeMetadata | String | The id of the NodeMetadata to remove |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
List the NodeMetadatas¶
Url: GET /scene/node/metadata/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | The file id the listed NodeMetadatas must be restricted to |
Success 200¶
| Name | Type | Description |
|---|---|---|
| objects | Object[] | The NodeMetadatas |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Update a NodeMetadata¶
Url: PUT /scene/node/metadata/:nodeMetadata
Parameter¶
| Name | Type | Description |
|---|---|---|
| nodeMetadata | String | The id of the NodeMetadata to update |
Body¶
| Name | Type | Description |
|---|---|---|
| files | String[] | The file ids this NodeMetadata is attached to. Must contain at least one element. |
| matchQuery | String | optional SmartShapeQL query that:
|
| tooltipQuery | String | optional SmartShapeQL query that:
|
Success 200¶
| Name | Type | Description |
|---|---|---|
| object | Object | The updated NodeMetadata |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
NodeSelectionMode¶
Create a NodeSelectionMode¶
Url: POST /scene/node-selection-mode/
Body¶
| Name | Type | Description |
|---|---|---|
| files | String[] | optional The id of the files this selection is attached to. Empty array if this selection is global (shared by all existing files). |
| name | String | Label displayed for this selection. Localized string. |
| query | String | Query to match the node that replaces the one picked by the user when this selection is enabled. |
| icon | String | optional Icon displayed for this selection. |
| sceneTreeIndex | Number | optional The index of the scene tree which gets displayed when this selection is enabled. If no value is defined, the scene tree that is currently displayed remains. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| object | Object | The created NodeSelectionMode |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Error-Response:
HTTP/1.1 500 Internal Error
{
"message": {
"errors": {
"query": {
"message": "Path `query` is required.",
"name": "ValidatorError",
"properties": {
"type": "required",
"message": "Path `{PATH}` is required.",
"path": "query"
},
"kind": "required",
"path": "query",
"$isValidatorError": true
}
},
"_message": "NodeSelectionMode validation failed",
"message": "NodeSelectionMode validation failed: query: Path `query` is required.",
"name": "ValidationError"
}
}
Example usage:
curl -X POST 'https://smartshape.io/scene/node-selection-mode/' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
--data '{
"files": ["5e42bba505dd2967ec30b7c4"],
"name": {
"en_US": "Pick the parent",
"fr_FR": "Sélectionner le parent"
},
"query": "@\"smartshape.scene.node.path|Shape\" && children:($smartshape.selected)",
"icon": "file-tree",
"sceneTreeIndex": 1
}'
Delete an NodeSelectionMode¶
Url: DELETE /scene/node-selection-mode/:nodeSelectionMode
Parameter¶
| Name | Type | Description |
|---|---|---|
| nodeSelectionMode | String | The id of the NodeSelectionMode to remove |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Error-Response:
Example usage:
List the NodeSelectionModes¶
Url: GET /scene/node-selection-mode/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | The file id the listed NodeSelectionModes must be restricted to |
Success 200¶
| Name | Type | Description |
|---|---|---|
| objects | Object[] | The NodeSelectionModes |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": {
"fr_FR": "Sélectionner le parent dans l'arbre de scène nommé \"Assembly\"",
"en_US": "Pick the parent in the scene tree named \"Assembly\""
},
"query": "@\"smartshape.scene.node.path|Assembly\" && children:($smartshape.selected)",
"icon": "file-tree",
"sceneTreeIndex": 1,
"files": [
"5e42bba505dd2967ec30b7c4"
],
"id": "5e42e3a35052e47ec97552c5"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Update an NodeSelectionMode¶
Url: PUT /scene/node-selection-mode/:nodeSelectionMode
Parameter¶
| Name | Type | Description |
|---|---|---|
| nodeSelectionMode | String | The id of the NodeSelectionMode to update |
Body¶
| Name | Type | Description |
|---|---|---|
| files | String[] | optional The id of the files this selection is attached to. Empty array if this selection is global (shared by all existing files). |
| name | String | Label displayed for this selection. Localized string. |
| query | String | Query to match the node that replaces the one picked by the user when this selection is enabled. |
| icon | String | optional Icon displayed for this selection. |
| sceneTreeIndex | Number | optional The index of the scene tree which gets displayed when this selection is enabled. If no value is defined, the scene tree that is currently displayed remains. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| object | Object | The updated NodeSelectionMode |
Success-Response:
HTTP/1.1 200 OK
{
"name": {
"fr_FR": "Sélectionner le parent dans l'arbre de scène nommé \"Assembly\"",
"en_US": "Pick the parent in the scene tree named \"Assembly\""
},
"query": "@\"smartshape.scene.node.path|Assembly\" && children:($smartshape.selected)",
"icon": "file-tree",
"sceneTreeIndex": 1,
"files": [
"5e42bba505dd2967ec30b7c4"
],
"id": "5e42e3a35052e47ec97552c5"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Error-Response:
Example usage:
curl -X PUT 'https://smartshape.io/scene/node-selection-mode/5e42e3a35052e47ec97552c5' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
--data '{
"name": {
"en_US": "Pick the parent in the scene tree named \"Assembly\"",
"fr_FR": "Sélectionner le parent dans l'\''arbre de scène nommé \"Assembly\""
},
"query": "@\"smartshape.scene.node.path|Assembly\" && children:($smartshape.selected)"
}'
Quotation¶
Add or update quotation attributes¶
Url: POST /scene/quotation/attributes/:file
Permissions: write_quotation
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| JSON | Object | object describing the attributes to add or update |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the updated quotations |
Success-Response:
HTTP/1.1 200 OK
[
{
"file": "65dcaba89739a7165181dddc",
"name": "Q2",
"colorId": 0,
"metric": "distance",
"type": "point-point",
"display": "distance",
"unit": "auto",
"quotationPoints": [
{
"pickingPoint": {
"position": {
"x": 24.999996185302734,
"y": 6.935495376586914,
"z": 9.045629501342773
},
"node": "65dcaba84e3898f85209e958",
"ray": {
"origin": {
"x": 84.805419921875,
"y": 30.661550521850586,
"z": 2.6049914360046387
},
"direction": {
"x": -0.9249016046524048,
"y": -0.3669276833534241,
"z": 0.09960562735795975
}
}
},
"pickingNormal": {
"x": 1,
"y": 0,
"z": 0
},
"measurePoint": {
"x": 24.999996185302734,
"y": 6.935495376586914,
"z": 9.045629501342773
}
},
{
"pickingPoint": {
"position": {
"x": 2.0689544677734375,
"y": 10,
"z": -9.274293899536133
},
"node": "65dcaba84e3898f85209e958",
"ray": {
"origin": {
"x": 84.80223083496094,
"y": 30.674497604370117,
"z": 2.5810437202453613
},
"direction": {
"x": -0.9609255194664001,
"y": -0.24012891948223114,
"z": -0.13769666850566864
}
}
},
"pickingNormal": {
"x": 0,
"y": 1,
"z": -4.371138473402425e-08
},
"measurePoint": {
"x": 2.0689544677734375,
"y": 10,
"z": -9.274293899536133
}
}
],
"projection": [],
"readPermissions": [],
"writePermissions": [],
"_id": "65dcabad55b9214ec7d58f2a",
"attributes": {
"status": {
"key": "status",
"value": "pendign",
"origin": "imported"
}
},
"__v": 0
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad request |
|
| 403 | Forbidden |
|
| 500 | Internal Error |
Example usage:
Create or update quotation(s)¶
Url: POST /scene/quotation/:file
Permissions: write_quotation
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| quotations | Object[] | Array of quotations to create or update. |
| quotations.id | String | optional The id of the quotation to update. The request will create the quotation if no id is provided. |
| quotations.name | String | The name of the quotation. |
| quotations.colorId | Number | The id of the color in which the quotation will be displayed. |
| quotations.type | String | The type of the quotation, among |
| quotations.metric | String | The metric of the quotation, possible values by types: |
| quotations.display | String | The type of display of the quotation, possible values by metrics: |
| quotations.quotationPoints | Object | The quotation points, each one represented by a triplet of vec3 (x, y, z). |
| quotations.quotationPoints.pickingPoint | Object | The point of the model where the user clicked. |
| quotations.quotationPoints.pickingNormal | Object | The normal of the model at the point where the user clicked. |
| quotations.quotationPoints.measurePoint | Object | The point actually used to perform the measure. |
| quotations.readPermissions | String[] | optional An array of the permissions needed to have read acess to the quotation. |
| quotations.writePermissions | String[] | optional An array of the permissions needed to have write acess to the quotation. |
| quotations.geodesic | Object | optional For quotations of type |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the created or updated quotation(s) |
Success-Response:
HTTP/1.1 200 OK
[
{
"name":"Quotation 1",
"colorId":0,
"type":"point-point",
"metric":"distance",
"display":"distance-and-components",
"unit":"auto",
"projection":[],
"file":"5bc9c33ed096371125683b80",
"writePermissions":[
],
"readPermissions":[
],
"quotationPoints":[
{
"measurePoint":{
"x":2.52279806137085,
"y":0.6178557276725769,
"z":-1.307135939598083
},
"pickingNormal":{
"x":0.4473114907741547,
"y":0.8608312606811523,
"z":0.2426560670137405
},
"pickingPoint":{
"node":"5bc9c33f830d6b2c353cff8a",
"position":{
"x":0.4527281820774078,
"y":0.8478289246559143,
"z":0.2683438658714294
},
"ray":{
"direction":{
"x":0.2072436213493347,
"y":-0.974147617816925,
"z":-0.08992500603199005
},
"origin":{
"x":-0.5336629152297974,
"y":5.484355449676514,
"z":0.6963484883308411
}
}
}
},
{
"measurePoint":{
"x":1.315723896026611,
"y":0.3600825071334839,
"z":-1.114719390869141
},
"pickingNormal":{
"x":-0.7856065630912781,
"y":0.616783082485199,
"z":0.04899929091334343
},
"pickingPoint":{
"node":"5bc9c33f830d6b2c353cff8a",
"position":{
"x":-0.7543460130691528,
"y":0.655412495136261,
"z":0.010570646263659
},
"ray":{
"direction":{
"x":-0.04012631252408028,
"y":-0.9894044399261475,
"z":-0.1395305544137955
},
"origin":{
"x":-0.558577835559845,
"y":5.482516765594482,
"z":0.6913120150566101
}
}
}
}
],
"id":"5bcdbd420954d71145c2a58e"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/quotation/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-d '[
{
"name":"First quotation",
"colorId":0,
"type":"point-point",
"metric":"distance",
"display":"distance-and-components",
"unit":"auto",
"quotationPoints":[
{
"measurePoint":{
"x":2.52279806137085,
"y":0.6178557276725769,
"z":-1.307135939598083
},
"pickingNormal":{
"x":0.4473114907741547,
"y":0.8608312606811523,
"z":0.2426560670137405
},
"pickingPoint":{
"node":"5bc9c33f830d6b2c353cff8a",
"position":{
"x":0.4527281820774078,
"y":0.8478289246559143,
"z":0.2683438658714294
},
"ray":{
"direction":{
"x":0.2072436213493347,
"y":-0.974147617816925,
"z":-0.08992500603199005
},
"origin":{
"x":-0.5336629152297974,
"y":5.484355449676514,
"z":0.6963484883308411
}
}
}
},
{
"measurePoint":{
"x":1.315723896026611,
"y":0.3600825071334839,
"z":-1.114719390869141
},
"pickingNormal":{
"x":-0.7856065630912781,
"y":0.616783082485199,
"z":0.04899929091334343
},
"pickingPoint":{
"node":"5bc9c33f830d6b2c353cff8a",
"position":{
"x":-0.7543460130691528,
"y":0.655412495136261,
"z":0.010570646263659
},
"ray":{
"direction":{
"x":-0.04012631252408028,
"y":-0.9894044399261475,
"z":-0.1395305544137955
},
"origin":{
"x":-0.558577835559845,
"y":5.482516765594482,
"z":0.6913120150566101
}
}
}
}
]
}
]'
Delete quotation(s)¶
Url: DELETE /scene/quotation/:file
Permissions: write_quotation
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| body | String[] | Array of quotation id to delete. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the removed quotation(s) |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "Quotation 1",
"colorId": 0,
"type": "point-point",
"metric": "distance",
"display": "distance-and-components",
"unit": "auto",
"projection":[],
"file": "5bc9c33ed096371125683b80",
"writePermissions": [],
"readPermissions": [],
"quotationPoints": [
{
"measurePoint": {
"x": 2.52279806137085,
"y": 0.6178557276725769,
"z": -1.307135939598083
},
"pickingNormal": {
"x": 0.4473114907741547,
"y": 0.8608312606811523,
"z": 0.2426560670137405
},
"pickingPoint": {
"node": "5bc9c33f830d6b2c353cff8a",
"position": {
"x": 0.4527281820774078,
"y": 0.8478289246559143,
"z": 0.2683438658714294
},
"ray": {
"direction": {
"x": 0.2072436213493347,
"y": -0.974147617816925,
"z": -0.08992500603199005
},
"origin": {
"x": -0.5336629152297974,
"y": 5.484355449676514,
"z": 0.6963484883308411
}
}
}
},
{
"measurePoint": {
"x": 1.315723896026611,
"y": 0.3600825071334839,
"z": -1.114719390869141
},
"pickingNormal": {
"x": -0.7856065630912781,
"y": 0.616783082485199,
"z": 0.04899929091334343
},
"pickingPoint": {
"node": "5bc9c33f830d6b2c353cff8a",
"position": {
"x": -0.7543460130691528,
"y": 0.655412495136261,
"z": 0.010570646263659
},
"ray": {
"direction": {
"x": -0.04012631252408028,
"y": -0.9894044399261475,
"z": -0.1395305544137955
},
"origin": {
"x": -0.558577835559845,
"y": 5.482516765594482,
"z": 0.6913120150566101
}
}
}
}
],
"id": "5bcdc0e70954d71145c2a591"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 500 | Internal Error |
Example usage:
List quotation(s)¶
Url: GET /scene/quotation/:file
Permissions: read_quotation
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the quotation(s) that belongs to the specified file |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "Quotation 1",
"colorId": 0,
"type": "point-point",
"metric": "distance",
"display": "distance-and-components",
"unit": "auto",
"projection":[],
"file": "5bc9c33ed096371125683b80",
"writePermissions": [],
"readPermissions": [],
"quotationPoints": [
{
"measurePoint": {
"x": 2.52279806137085,
"y": 0.6178557276725769,
"z": -1.307135939598083
},
"pickingNormal": {
"x": 0.4473114907741547,
"y": 0.8608312606811523,
"z": 0.2426560670137405
},
"pickingPoint": {
"node": "5bc9c33f830d6b2c353cff8a",
"position": {
"x": 0.4527281820774078,
"y": 0.8478289246559143,
"z": 0.2683438658714294
},
"ray": {
"direction": {
"x": 0.2072436213493347,
"y": -0.974147617816925,
"z": -0.08992500603199005
},
"origin": {
"x": -0.5336629152297974,
"y": 5.484355449676514,
"z": 0.6963484883308411
}
}
}
},
{
"measurePoint": {
"x": 1.315723896026611,
"y": 0.3600825071334839,
"z": -1.114719390869141
},
"pickingNormal": {
"x": -0.7856065630912781,
"y": 0.616783082485199,
"z": 0.04899929091334343
},
"pickingPoint": {
"node": "5bc9c33f830d6b2c353cff8a",
"position": {
"x": -0.7543460130691528,
"y": 0.655412495136261,
"z": 0.010570646263659
},
"ray": {
"direction": {
"x": -0.04012631252408028,
"y": -0.9894044399261475,
"z": -0.1395305544137955
},
"origin": {
"x": -0.558577835559845,
"y": 5.482516765594482,
"z": 0.6913120150566101
}
}
}
}
],
"id": "5bcdc0e70954d71145c2a591"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Validate attributes update¶
Url: POST /scene/quotation/attribute/validate/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| attributes | Object | Object that maps attribute keys to the corresponding updated value |
| id | String | optional The ID of the quotation to update. |
| name | String | optional If no |
| colorId | Number | optional If no |
| metric | String | optional If no |
| type | String | optional If no |
| display | String | optional If no |
| unit | String | optional If no |
| quotationPoints | Object | optional If no |
| projection | Object | optional (deprecated) If no |
| geodesic | Object | optional If no |
| curvature | Object | optional If no |
| readPermissions | String[] | optional If no |
| writePermissions | String[] | optional If no |
Success 200¶
| Name | Type | Description |
|---|---|---|
| messages | Object[] | Array of localized error messages (may be empty) |
| attributeMetadata | Object[] | The list of updated AttributeMetadata resulting from the applied attributes changes |
| values | Object[] | The values of each updated attributes |
Success-Response:
HTTP/1.1 200 OK
{
"messages": [
{
"key": "Status",
"message": "Status can only be 'Pending' or 'Validated'"
"level": 3
}
],
"attributeMetadata": [
{
"id": "5c1a22348074992387810368",
"key": "Status",
"label": "Status",
"validator": {
"query": "(apply($incoming, @\"status\"=\"Pending\" || @\"status\"=\"Validated\") && nth(array(-1), 0)) || nth(array(0), 0)",
"messages": [
{
"level": 3,
"message": "Status can only be 'Pending' or 'Validated'"
}
]
},
"writePermissions": [],
"readPermissions": [],
"files": [
"5c1a222699f4f81688cbfdbf"
]
}
],
"values": {}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 403 | Forbidden |
|
| 404 | Not Found |
|
| 500 | Internal Error |
Example usage:
RenderStyle¶
Apply a render style¶
Url: POST /scene/render-style/apply/:file/:renderStyle
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| renderStyle | String | Render style id |
Body¶
| Name | Type | Description |
|---|---|---|
| variables | Object | Search variables |
Success 200¶
| Name | Type | Description |
|---|---|---|
| data | Object | A JSON object with the surfaces corresponding to every color index and the associated legend formatted labels |
Success-Response:
HTTP/1.1 200 OK
{
"data": {
"colors": [
{
"index": 0,
"legend": {
"min": "1000 mm",
"max": "1000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "7a19164d-644a-684d-59c4-367e23e02b73",
"attributes": {
"subsurfaces": [
5
]
}
}
]
},
{
"index": 2,
"legend": {
"min": "2000 mm",
"max": "2000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "7a19164d-644a-684d-59c4-367e23e02b73",
"attributes": {
"subsurfaces": [
1,
2
]
}
}
]
},
{
"index": 4,
"legend": {
"min": "3000 mm",
"max": "3000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "7a19164d-644a-684d-59c4-367e23e02b73",
"attributes": {
"subsurfaces": [
0
]
}
}
]
},
{
"index": 6,
"legend": {
"min": "4000 mm",
"max": "4000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "7a19164d-644a-684d-59c4-367e23e02b73",
"attributes": {
"subsurfaces": [
3
]
}
}
]
},
{
"index": 8,
"legend": {
"min": "5000 mm",
"max": "5000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "7a19164d-644a-684d-59c4-367e23e02b73",
"attributes": {
"subsurfaces": [
4
]
}
}
]
},
{
"index": 10,
"legend": {
"min": "10000 mm",
"max": "10000 mm"
},
"surfaces": [
{
"type": "surface",
"id": "52cb443a-5daf-3442-2639-2bd811f76a1e",
"attributes": {
"subsurfaces": [
0
]
}
}
]
}
],
"ast": {
"expr": {
"expr": {
"type": "ATTRIBUTE",
"expr": {
"value": "thickness",
"rawValue": "thickness",
"type": "STRING"
}
}
}
}
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Render style not found |
|
| 500 | Internal Error |
Example usage:
Create a render style¶
Url: PUT /scene/render-style/
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Render style name |
| files | String[] | optional Array of file ids |
| valueQuery | String | Executed on: all the nodes of the scene. |
| indexQuery | String | Executed on: all the nodes of the scene. |
| legendQuery | String | optional Executed on: the nodes with the smallest and highest value of each index. |
| orderQuery | String | optional Executed on: the node with the smallest value of each index. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object | JSON object of the new render style saved into the database |
Success-Response:
HTTP/1.1 200 OK
{
"name": "Color by thickness",
"files": ["5bcdb47d30746e179fd3dddc"],
"valueQuery": "@\"thickness\"",
"indexQuery": "@\"thickness\" && indexOf(sort(unique(map(select(@\"thickness\" && $smartshape.visibleNodes), @\"thickness\"))), @\"thickness\")",
"legendQuery": "@\"thickness\"",
"orderQuery": "multiply(-1, @\"thickness\")",
"id": "5bcdb7574a35dc3ac6509f9e"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
curl -X PUT \
https://smartshape.io/scene/render-style \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Color by thickness",
"files": ["5bcdb47d30746e179fd3dddc"],
"valueQuery": "@\"thickness\"",
"indexQuery": "@\"thickness\" && indexOf(sort(unique(map(select(@\"thickness\" && $smartshape.visibleNodes), @\"thickness\"))), @\"thickness\")",
"legendQuery": "@\"thickness\"",
"orderQuery": "multiply(-1, @\"thickness\")"
}'
Delete a render style¶
Url: DELETE /scene/render-style/:renderStyle
Parameter¶
| Name | Type | Description |
|---|---|---|
| renderStyle | String | Render style id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Render style not found |
|
| 500 | Internal Error |
Example usage:
List render styles¶
Url: GET /scene/render-style/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id (optional) |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the render styles that belong to the specified file if given, or all the render styles otherwise. |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "Color by thickness",
"valueQuery": "@\"thickness\"",
"indexQuery": "@\"thickness\" && indexOf(sort(unique(map(select(@\"thickness\" && $smartshape.visibleNodes), @\"thickness\"))), @\"thickness\")",
"legendQuery": "@\"thickness\"",
"orderQuery": "multiply(-1, @\"thickness\")",
"files": [
"5bcdb47d30746e179fd3dddc"
],
"id": "5bcdb7574a35dc3ac6509f9e"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Update a render style¶
Url: POST /scene/render-style/:renderStyle
Parameter¶
| Name | Type | Description |
|---|---|---|
| renderStyle | String | Render style Id |
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Render style name |
| files | String[] | optional Array of file ids (optional) |
| valueQuery | String | Query used to compute the value that maps to a node for this render style |
| indexQuery | String | Query used to compute the legend step (thus the palette color index) a node belongs to for this render style |
| legendQuery | String | Query used to format the legend labels |
| orderQuery | String | optional Query used to order the legend labels (the default ordering is ascending, with a lexicographic order for String values) |
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | ID of the updated Render style |
| name | String | Render style name |
| files | String[] | optional Array of file ids (optional) |
| valueQuery | String | Query used to compute the value that maps to a node for this render style |
| indexQuery | String | Query used to compute the legend step (thus the palette color index) a node belongs to for this render style |
| legendQuery | String | Query used to format the legend labels |
| orderQuery | String | optional Query used to order the legend labels (the default ordering is ascending, with a lexicographic order for String values) |
Success-Response:
HTTP/1.1 200 OK
{
"name": "Color by thickness",
"valueQuery": "@\"thickness\"",
"indexQuery": "@\"thickness\" && indexOf(sort(unique(map(select(@\"thickness\" && $smartshape.visibleNodes), @\"thickness\"))), @\"thickness\")",
"legendQuery": "@\"thickness\"",
"orderQuery": "multiply(-1, @\"thickness\")",
"files": [
"5bcdb47d30746e179fd3dddc"
],
"id": "5bcdb7574a35dc3ac6509f9e"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal error |
Example usage:
curl -X POST https://smartshape.io/scene/render-style/5bcdb7574a35dc3ac6509f9e \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-d '{
"name": "Color by thickness",
"files": ["5bcdb47d30746e179fd3dddc"],
"valueQuery": "@\"thickness\"",
"indexQuery": "@\"thickness\" && indexOf(sort(unique(map(select(@\"thickness\" && $smartshape.visibleNodes), @\"thickness\"))), @\"thickness\")",
"legendQuery": "@\"thickness\"",
"orderQuery": "multiply(-1, @\"thickness\")"
}'
Scene¶
Add or update node attributes¶
Url: POST /scene/attributes/:file
Permissions: edit_scene_node_attribute
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| return | String | optional Set to "false" to skip the returned body and return a 204. |
Body¶
| Name | Type | Description |
|---|---|---|
| JSON | Object | object describing the attributes to add or update |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | Object[] | Updated nodes |
| result._id | String | Id of the Node |
| result.position | Object | optional Position of the Node |
| result.position.x | Number | X coordinate of the position of the Node |
| result.position.y | Number | Y coordinate of the position of the Node |
| result.position.z | Number | Z coordinate of the position of the Node |
| result.rotation | Object | optional Rotation of the Node |
| result.rotation.x | Number | X coordinate of the rotation of the Node |
| result.rotation.y | Number | Y coordinate of the rotation of the Node |
| result.rotation.z | Number | Z coordinate of the rotation of the Node |
| result.scale | Object | optional Scale of the Node |
| result.scale.x0 | Number | X0 coordinate of the scale of the Node |
| result.scale.x1 | Number | X1 coordinate of the scale of the Node |
| result.scale.x2 | Number | X2 coordinate of the scale of the Node |
| result.scale.y0 | Number | Y0 coordinate of the scale of the Node |
| result.scale.y1 | Number | Y1 coordinate of the scale of the Node |
| result.scale.y2 | Number | Y2 coordinate of the scale of the Node |
| result.scale.z0 | Number | Z0 coordinate of the scale of the Node |
| result.scale.z1 | Number | Z1 coordinate of the scale of the Node |
| result.scale.z2 | Number | Z2 coordinate of the scale of the Node |
Success-Response:
HTTP/1.1 200 OK
[
{
"_id": "5964f9e0435711191f0f9132",
"attributes": {
"id": {
"key": "id",
"value": "n°03",
"origin": "imported"
},
"color": {
"key": "color",
"value": "red",
"origin": "imported"
},
"material": {
"key": "material",
"value": "metal",
"origin": "imported"
}
},
"name": "cube_red_03",
"uuid": "63afbfb0-7181-6b8a-23df-3169340666d9",
"surfaces": [
"61986e58-3484-71e1-2348-2e659f312b37"
],
"aabb": [
-15,
10,
15,
-25,
2.58280209664008e-7,
5
],
"position": null,
"scale": null,
"rotation": null,
"parents": [
"53026a6e-535a-719d-24f6-254ff62f5406"
],
"file": "5964f9dfd350142ba6312bc4",
"numChildren": 0,
"sceneTreeIndices": [
0
],
"geometryHashes": [
"79a2fe8ca672cae6762146e8091eeeb5"
],
"transform": {
"modelToWorldMatrix": {
"data": [
0.001000000047497451,
0,
0,
0,
0,
0.001000000047497451,
0,
0,
0,
0,
0.001000000047497451,
0,
0,
0,
0,
1
]
}
},
"layers": [],
"__v": 2,
"attributeMetadata": {}
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 403 | Forbidden |
|
| 500 | Internal Error |
Example usage:
Create an attribute metadata¶
Url: POST /scene/attribute/metadata/
Body¶
| Name | Type | Description |
|---|---|---|
| key | String | Determines which attributes this attribute metadata applies to. This |
| files | String[] | Array of file ids |
| searchQuery | String | optional Query that determines which nodes of the scene this attribute metadata has an effect on |
| revisionMergeQuery | String | optional Determines the new value of the attribute when a new revision of the file is uploaded. The $current and $incoming variables represent respectively the node currently stored in Smartshape and the new node stored in the uploaded file |
| label | String | optional Label to show in the UI instead of the attribute's key |
| readPermissions | String[] | optional Permissions needed to read the attribute |
| writePermissions | String[] | optional Permissions needed to edit the attribute |
| editor | Object | optional Determines the kind of editor shown in the UI when editing the attribute. If not provided, the attribute is not editable |
| editor.type | String | Determines the type of editor shown in the UI when editing the attribute. |
| editor.parameters | String[] | optional Determines the choices for the select and checklist editor types |
| editor.min | Number | optional Determines the minimum value a user can enter for the number editor type |
| editor.max | Number | optional Determines the maximum value a user can enter for the number editor type |
| editor.step | Number | optional Determines the step of the value a user can enter for the number editor type |
| editor.updateOnlyQuery | String | optional SmartShapeQL query that determines if the attribute can only be updated or if it can also be created. The query takes the current Node/Annotation in input and must return a truthy value if the attribute can only be updated or a falsy value if the attribute can be created as well |
| validator | Object | optional Determines if an Attribute is valid on edition |
| validator.query | String | optional SmartShapeQL query to be called when the Attribute is updated and returning an index : |
| validator.messages | Object[] | optional Messages to be displayed in the UI in case |
| validator.messages.level | Number | optional The importance of the message to be displayed. For now only the value 3 is handled by the UI (which corresponds to an error message) |
| validator.messages.message | Object | optional The different translations of the message to be displayed, indexed by their ICU Locale |
| valueQuery | String | optional SmartShapeQL query that determines the value of the attributes matched by 'searchQuery', overriding any previous value. The query has access to the current object ('.'), and is executed when the object is saved or when the attributes are validated. The query cannot contain hierarchical operators or the 'select' function. |
Success-Response:
HTTP/1.1 200 OK
{
"key": "Remarque",
"files": [],
"editor": {
"type": "select",
"parameters": [
"value1",
"value2"
],
"updateOnlyQuery": "false",
"_id": "6479e7c317e20545b8a34c1e"
},
"validator": {
"query": "(apply($incoming, @\"material\"=\"metal\") && nth(array(-1), 0)) || nth(array(0), 0)",
"messages": [
{
"level": 1,
"message": {
"fr_FR": "Message en français",
"en_US": "Error message in english"
}
}
]
},
"readPermissions": [],
"writePermissions": [],
"order": 0,
"id": "6479e7c317e20545b8a34c1d"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/attribute/metadata/ \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"key": "Remarque",
"editor": {
"type": "select",
"parameters": [ "value1", "value2" ],
"updateOnlyQuery": "false"
},
"validator": {
"query": "(apply($incoming, @\"material\"=\"metal\") && nth(array(-1), 0)) || nth(array(0), 0)",
"messages": [
{
"level": 1,
"message": {
"fr_FR": "Message en français",
"en_US": "Error message in english"
}
}
]
}
}'
Delete an attribute metadata¶
Url: DELETE /scene/attribute/metadata/:attributeMetadata
Parameter¶
| Name | Type | Description |
|---|---|---|
| attributeMetadata | String | Attribute metadata id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | Object | A JSON object with a success field set to true |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Not Found |
|
| 500 | Internal error |
Example usage:
Get attribute(s) metadata¶
Url: GET /scene/attribute/metadata/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | optional File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| key | Object | Attribute metadata object(s) |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal error |
Example usage:
Get common attributes for a nodes list¶
Url: POST /scene/attributes/common/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| JSON | Object | object containing a query filtering the nodes |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the common attributes of all nodes |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 404 | Not Found |
|
| 500 | Internal Error |
Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{ "query": "id:5964f9e0435711191f0f9132 or id:5964f9e0435711191f0f9133 or id:5964f9e0435711191f0f9134" }' 'https://smartshape.io/scene/attributes/5964f9dfd350142ba6312bc4/'
List file searches¶
Url: GET /scene/search/list/
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | Search id |
| name | String | Search name (for favorited searches only) |
| search | String | Search query |
| type | String | Either |
| date | String | Date when the query was run or saved |
Success-Response:
HTTP/1.1 200 OK
[
{
"id":"58d15f9f765ae21da4b6371b",
"name":"foobar",
"search":"attribute:foo=bar",
"date":"2017-03-21T17:15:11.758Z",
"context":"scene",
"type":"favorite",
"user":"test@smartshape.io"
},
{
"id":"58d15f9f765ae21da4b6371d",
"name":"",
"search":"*_cube",
"date":"2017-03-21T17:10:11.758Z",
"context":"scene",
"type":"history",
"user":"test@smartshape.io"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 500 | Internal Error |
Example usage:
List node ancestors¶
Url: GET /scene/ancestors/:file/:nodeId/:sceneTreeIndex
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| nodeId | String | Node id or uuid |
| sceneTreeIndex | Int | Index of the scene tree |
Success 200¶
| Name | Type | Description |
|---|---|---|
| type | String | Type of data. Always contains "node". |
| id | String | ID of the Node. |
| uuid | String | UUID of the Node. |
| attributes | Object | Object containing more details about the Node. |
| attributes.name | String | Name of the Node. |
| attributes.file | String | ID of the File the Node is part of. |
| attributes.numChildren | String | Number of children of the Node. |
Success-Response:
HTTP/1.1 200 OK
[
{
"type": "node",
"id": "58a5c4970bcb1a257712b99f",
"uuid": "2e36584e-67e3-4dec-6821-51df55b12210",
"attributes": {
"name": "node name",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 3
}
},
{
"type": "node",
"id": "58a5c4970bcb1a257712b99g",
"uuid": "594313d0-36e2-2488-7a4d-5f56615a4fbe",
"attributes": {
"name": "node name 2",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 0
}
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List node children¶
Url: GET /scene/children/:file/:nodeId
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| nodeId | String | Node id or uuid |
| #### query string | ||
| Name | Type | Description |
| :--------- | :----------- | :-------------------------------------- |
| attributeKey | String | optional Fill the returned nodes with the attribute defined with the key 'attributeKey' for the nodes that hold such an attribute |
Success 200¶
| Name | Type | Description |
|---|---|---|
| node | Object | Root node |
| children | Array | Root node children |
Success-Response:
HTTP/1.1 200 OK
{
"data": {
"node": {
"type": "node",
"id": "58a5c4970bcb1a257712b99a",
"uuid": "75a713a1-1b95-c1c2-354e-40fd140c14d4",
"attributes": {
"name": "node name",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 2,
"numAttributes": 10,
"layerColors": [1]
}
},
"children": [
{
"type": "node",
"id": "58a5c4970bcb1a257712b99f",
"uuid": "2e36584e-67e3-4dec-6821-51df55b12210",
"attributes": {
"name": "node name",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 3,
"numAttributes": 10,
"layerColors": [1]
}
},
{
"type": "node",
"id": "58a5c4970bcb1a257712b99g",
"uuid": "594313d0-36e2-2488-7a4d-5f56615a4fbe",
"attributes": {
"name": "node name 2",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 0,
"numAttributes": 10,
"layerColors": [1, 2, 3]
}
}
]
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List original nodes for a list of surfaces¶
Url: POST /scene/nodes/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| data | String | Query as a JSON object. |
Success-Response:
HTTP/1.1 200 OK
[
{
"data":{
"type":"surface",
"id":"4dec5bdd-69c0-7388-574a-148912a934d4",
"attributes":{
"source":false,
"subsurface":"1"
},
"relationships":{
"target":{
"data":{
"type":"node",
"uuid":"313f2ee5-70f3-4e01-1f3e-3af62f612038",
"id":"58d2a2bc7cd6c01ac9b9127e"
}
},
"surfaces":{
"data":[
{
"type":"surface",
"id":"7f853e8e-5afb-2ff9-2abc-131339a37b97",
"attributes":{
"source":true
}
},
{
"type":"surface",
"id":"4dec5bdd-69c0-7388-574a-148912a934d4",
"attributes":{
"source":false,
"subsurface":1
}
}
]
}
}
}
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{"exportSurfaces": { "3b674558-5ecd-45db-78f5-538376c61abb": [1, 2], "136071a1-474c-398d-4339-70673e557ec6": [0, 1] }}' 'https://smartshape.io/scene/nodes/58d2a2ba7745a51a7153ef97/'
List scene dependencies status¶
Url: GET /scene/dependencies/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List surfaces for a search query¶
Url: GET /scene/surfaces/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | Export surface id |
| attributes | Object | Containing the list of subsurfaces in the export surface |
Success-Response:
HTTP/1.1 200 OK
{
"data": {
"cube": {
"nodes": [
{
"type": "surface",
"id": "4bde5b30-64d2-6e36-4e25-a2787a187e0d",
"attributes": {
"subsurfaces": [
0,
1
]
}
},
{
"type": "surface",
"id": "50149db8-241c-670a-4b1a-4ed9377762e4",
"attributes": {
"subsurfaces": [
2,
3
]
}
}
],
"ast": {
"expr": {
"expr": {
"type": "NAME",
"expr": {
"value": "cube",
"rawValue": "cube",
"type": "GLOBBING"
}
}
}
}
}
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List surfaces for a search query (POST)¶
Url: POST /scene/surfaces/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| queries | String[] | Search queries |
| searchQueriesAst | Boolean[] | Return the AST of the search queries. Defaults to true. |
Success 200¶
| Name | Type | Description |
|---|---|---|
| id | String | Export surface id |
| attributes | Object | Containing the list of subsurfaces in the export surface |
Success-Response:
HTTP/1.1 200 OK
{
"data": {
"cube": {
"nodes": [
{
"type": "surface",
"id": "4bde5b30-64d2-6e36-4e25-a2787a187e0d",
"attributes": {
"subsurfaces": [
0,
1
]
}
},
{
"type": "surface",
"id": "50149db8-241c-670a-4b1a-4ed9377762e4",
"attributes": {
"subsurfaces": [
2,
3
]
}
}
],
"ast": {
"expr": {
"expr": {
"type": "NAME",
"expr": {
"value": "cube",
"rawValue": "cube",
"type": "GLOBBING"
}
}
}
}
}
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Remove a scene search query from favorites¶
Url: DELETE /scene/search/delete/:searchId
Parameter¶
| Name | Type | Description |
|---|---|---|
| searchId | String | Id of the search to remove |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 500 | Internal Error |
Example usage:
Save a scene search query to favorites¶
Url: POST /scene/search/save/
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Name to save the query with |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
Example usage:
Save a scene search query to history¶
Url: POST /scene/search/history/
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Name to save the query with |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 500 | Internal Error |
Example usage:
Search nodes¶
Url: POST /scene/search/:file/
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| queries | String[] | Search queries |
Success-Response:
HTTP/1.1 200 OK
{
"data": {
"cube": {
"nodes": [
{
"type": "node",
"id": "5af595aed59ab66152765fbd",
"uuid": "618a4e38-4507-29c0-485a-32c86cf826a5",
"attributes": {
"name": "cube_green",
"parentLayerColors": [],
"layerColors": []
}
},
{
"type": "node",
"id": "5af595aed59ab66152765fbf",
"uuid": "14a77c76-8d71-6aca-6dda-62cd551213ef",
"attributes": {
"name": "cube_blue",
"parentLayerColors": [],
"layerColors": []
}
},
{
"type": "node",
"id": "5af595aed59ab66152765fc2",
"uuid": "b0a549dd-2a37-403a-ad0a-4fbfa22ae90c",
"attributes": {
"name": "Cube",
"parentLayerColors": [],
"layerColors": []
}
}
],
"ast": {
"expr": {
"expr": {
"type": "NAME",
"expr": {
"value": "cube",
"rawValue": "cube",
"type": "GLOBBING"
}
}
}
}
},
"sphere": {
"nodes": [
{
"type": "node",
"id": "5af595aed59ab66152765fbc",
"uuid": "6238483b-58f7-6d4c-c17b-6f6e510d6522",
"attributes": {
"name": "sphere_yellow",
"parentLayerColors": [],
"layerColors": []
}
},
{
"type": "node",
"id": "5af595aed59ab66152765fbe",
"uuid": "17bf76f2-107f-483a-2c08-6c7147ebe55d",
"attributes": {
"name": "sphere_red",
"parentLayerColors": [],
"layerColors": []
}
},
{
"type": "node",
"id": "5af595aed59ab66152765fc1",
"uuid": "2a7c6956-b135-477f-b0fd-b94c03b4f97d",
"attributes": {
"name": "Sphere",
"parentLayerColors": [],
"layerColors": []
}
}
],
"ast": {
"expr": {
"expr": {
"type": "NAME",
"expr": {
"value": "sphere",
"rawValue": "sphere",
"type": "GLOBBING"
}
}
}
}
}
}
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad Request |
|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
Example usage: Export the results as XLSX file.
Validate attributes update¶
Url: POST /scene/attribute/validate/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Body¶
| Name | Type | Description |
|---|---|---|
| query | String | A search query to filter the nodes the attribute update is applied on |
| attributes | Object | Object that maps attribute keys to the corresponding updated value |
Success 200¶
| Name | Type | Description |
|---|---|---|
| errors | Object[] | Array of localized error messages (may be empty). |
| attributeMetadata | Object[] | The list of updated AttributeMetadata resulting from the applied attributes changes |
| values | Object[] | The values of each updated attributes shared by all the nodes matching 'query' |
Success-Response:
HTTP/1.1 200 OK
{
"messages": [
{
"key": "TypeDefaut",
"message": {
"en_US": "A default type may not be specified if no remark type or no object type is specified.",
"fr_FR": "Le type de défaut ne peut pas être renseigné sans qu'un type de remarque et un type d'objet ne soient renseignés."
},
"level": 3
}
],
"attributeMetadata": [
{
"id": "5c1a22348074992387810368",
"key": "TypeDefaut",
"label": {
"fr_FR": "TypeDefaut",
"en_US": "DefectType"
},
"validator": {
"query": "(apply($incoming, @\"TypeDefaut\"=\"\" || (@\"TypeRemarque\"!=\"\" && @\"TypeObjet\"!=\"\")) && nth(array(-1), 0)) || nth(array(0), 0)",
"messages": [
{
"level": 3,
"message": {
"fr_FR": "Le type de défaut ne peut pas être renseigné sans qu'un type de remarque et un type d'objet ne soient renseignés.",
"en_US": "A default type may not be specified if no remark type or no object type is specified."
}
}
]
},
"writePermissions": [],
"readPermissions": [],
"files": [
"5c1a222699f4f81688cbfdbf"
]
}
]
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 500 | Internal Error |
Example usage:
curl -X POST \
https://smartshape.io/scene/attribute/validate/5c122a0a519da87cfb037980 \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"query": "id:5c122a13faef856fd019c0fb or id:5c122a13faef856fd019c0ef",
"attributes": {
"TypeDefaut": "Coupé"
}
}'
SceneFolder¶
Create a scene folder¶
Url: PUT /scene/folder/
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | Scene folder name |
| files | String[] | optional Array of file ids |
| order | Number | optional Used to sort the folders |
| description | Object | optional Scene folder description |
| writePermissions | String[] | optional Permission to set the folder to an object |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the new scene folder saved into the database |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Delete scene folder¶
Url: DELETE /scene/folder/:folderId
Parameter¶
| Name | Type | Description |
|---|---|---|
| folderId | String | Scene folder id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Scene folder not found |
|
| 500 | Internal Error |
Example usage:
List scene folders¶
Url: GET /scene/folder/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | optional File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the scene folders that belong to the specified file if given, or all the scene folders otherwise. |
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "First scene folder",
"description": "A folder for beheviors",
"files": [
"5b9691f80cd2e33c10463c43"
],
"order": 1,
"id": "5b9694a57192d23c24104980",
"writePermissions": ["folder_permission"]
},
{
"name": "Second scene folder",
"files": [
"5b9691f80cd2e33c10463c43"
],
"order": 2,
"id": "5b9694b07192d23c24104981",
"writePermissions": []
}
]
Example usage:
Update a scene folder¶
Url: POST /scene/folder/:folder
Parameter¶
| Name | Type | Description |
|---|---|---|
| folder | String | Scene folder id |
Body¶
| Name | Type | Description |
|---|---|---|
| name | String | optional Scene folder name |
| files | String[] | optional Array of file ids |
| order | Number | optional Used to sort the folders |
| description | Object | optional Scene folder description |
| writePermissions | String[] | optional Permission to set the folder to an object |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | Object | JSON object of the new scene folder saved into the database |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal error |
Example usage:
curl -X POST 'https://smartshape.io/scene/folder/5b9694a57192d23c24104980/' \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-d '{
"name": "Quite important layers",
"files": ["5b9691f80cd2e33c10463c43"],
"order": 3,
"description": "The layers stored in this folder are of average utility",
"writePermissions": ["folder_permissions"]
}'
SceneSearchForm¶
Create a search form¶
Url: POST /scene/search/form/
Body¶
| Name | Type | Description |
|---|---|---|
| files | String[] | optional Array of file ids for which the search form should be created |
| name | String | Name of the search form |
| description | String | optional Description of the search form |
| searchQuery | String | Query executed for the search, can contain references to the form fields noted with $ ($fieldName) |
| fields | Object[] | Fields of the search form |
| fields.name | string | Name of the field (can be used in the searchQuery) |
| fields.label | String | Label shown next to the field in the UI |
| fields.type | String | Determines the type of field shown in the UI |
| fields.data | String[] | optional Values showed in the drop down menu when the type is |
| readPermissions | String[] | optional Permissions required to read this search form |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the created search form |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Missing argument |
|
| 500 | Internal Error |
Error-Response:
Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{"files":["5ffebbd74507e30a9bfc61d5"],"name":"Color","description":"Search by color","searchQuery":"@color=$color","fields":[{"type":"select","name":"color","label":"Color","data":["blue","red"]}],"readPermissions":[]}' 'https://smartshape.io/scene/search/form/'
Delete a search form¶
Url: DELETE /scene/search/form/:searchform
Parameter¶
| Name | Type | Description |
|---|---|---|
| searchform | String | Search Form _id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal Error |
Example usage:
List search forms¶
Url: GET /scene/search/form/:file
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
Success-Response:
HTTP/1.1 200 OK
{
"data": [
{
"type": "searchform",
"id": "5a1d23f24c5fd80c9d438746",
"name": "Double fonction appareil",
"searchQuery": "@FonctionAppareil=$equipFn1 or @FonctionAppareil=$equipFn2",
"fields": [
{
"type": "select",
"name": "equipFn1",
"label": "Premier équipement",
"data": [
"DES",
"ELP",
"DHA"
]
},
{
"type": "select",
"name": "equipFn2",
"label": "Deuxième équipement",
"data": [
"DES",
"ELP",
"DHA"
]
}
]
}
]
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Example usage:
Snippet¶
Create a Snippet¶
Url: POST /scene/snippet/
Permissions: write_snippet
Body¶
| Name | Type | Description |
|---|---|---|
| title | String | Snippet name |
| description | String | Snippet description |
| files | String[] | optional Array of file ids (optional) |
| code | String | Query executed by this snippet |
| defaultExportFormat | String | Format used by default when executing the snippet. |
| supportedExportFormats | String | Supported exports formats when executing the snippet |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the new Snippet saved into the database |
Success-Response:
HTTP/1.1 200 OK
{
"title": "Snippet",
"description": "Snippet description",
"code": "map(select(name:cube_red*), array(get(., \"name\"), @\"Center X\", @\"Center Y\", @\"Center Z\"))",
"defaultExportFormat": "csv",
"writePermissions": [],
"readPermissions": [],
"supportedExportFormats": [
"csv"
],
"files": [],
"id": "5fff0f5bd714320623e65af9"
}
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Error-Response:
Example usage:
curl -X POST \
https://smartshape.io/scene/snippet \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-H 'Content-Type: application/json' \
-d '{
"title": "Snippet",
"description": "Snippet description",
"code": "map(select(name:cube_red*), array(get(., \"name\"), @\"Center X\", @\"Center Y\", @\"Center Z\"))",
"defaultExportFormat": "csv",
"supportedExportFormats": ["csv"],
"files": []
}'
Delete a Snippet¶
Url: DELETE /scene/snippet/:snippet
Permissions: write_snippet
Parameter¶
| Name | Type | Description |
|---|---|---|
| snippet | String | Snippet id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| success | Boolean |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Snippet not found |
|
| 500 | Internal Error |
Error-Response:
Example usage:
Execute a Snippet¶
Url: POST /scene/snippet/execute/:file/:snippet
Permissions: read_snippet
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | File id |
| snippet | String | Snippet id |
Body¶
| Name | Type | Description |
|---|---|---|
| variables | Object | optional Search variables |
| format | Object | Format used to export the result of the execution of the snippet |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | string | result of the execution |
| format | string | requested format |
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 400 | Bad request |
|
| 404 | Not found |
|
| 500 | Internal Error |
Error-Response:
Error-Response:
Example usage:
List snippets¶
Url: GET /scene/snippet/:file
Permissions: read_snippet
Parameter¶
| Name | Type | Description |
|---|---|---|
| file | String | optional File id |
Success 200¶
| Name | Type | Description |
|---|---|---|
| body | Object[] | Array of the snippets that belong to the specified file if given, or all the snippets otherwise. |
Success-Response:
HTTP/1.1 200 OK
[
{
"title": "My first snippet",
"description": "Snippet description",
"code": "array(array(\"Field 1\", \"Field 2\"), array(\"Field 1\", \"Field 2\"))",
"defaultExportFormat": "csv",
"supportedExportFormats": ["csv"],
"files": [
"5bcdb47d30746e179fd3dddc"
],
"id": "5bcdb7574a35dc3ac6509f9e"
}
]
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 500 | Internal Error |
Error-Response:
Example usage:
Update a Snippet¶
Url: PUT /scene/snippet/:snippet
Permissions: write_snippet
Parameter¶
| Name | Type | Description |
|---|---|---|
| snippet | String | Snippet id |
Body¶
| Name | Type | Description |
|---|---|---|
| title | String | Snippet name |
| description | String | Snippet description |
| files | String[] | optional Array of file ids (optional) |
| code | String | Query executed to compute the rest of the file |
| defaultExportFormat | String | Format used by default when executing the snippet. |
| supportedExportFormats | String | Supported exports formats when executing the snippet |
Success 200¶
| Name | Type | Description |
|---|---|---|
| result | String | JSON object of the updated Snippet |
Success-Response:
Error 4xx¶
| Name | Type | Description |
|---|---|---|
| 404 | Not found |
|
| 500 | Internal error |
Error-Response:
HTTP/1.1 500 Internal Error
{
"errors": {
"code": {
"message": "Unexpected token ')' on line 1 column 25",
"name": "ValidatorError",
"properties": {
"type": "user defined",
"message": "Unexpected token ')' on line 1 column 25",
"isAsync": true,
"path": "code",
"value": "query with syntax error()"
},
"kind": "user defined",
"path": "code",
"value": "query with syntax error()",
"$isValidatorError": true
}
},
"_message": "Snippet validation failed",
"message": "Snippet validation failed: code: Unexpected token ')' on line 1 column 25",
"name": "ValidationError"
}
Error-Response:
Example usage:
curl -X PUT \
https://smartshape.io/scene/snippet/5bcdb7574a35dc3ac6509f9e \
-H 'Authorization: Bearer <auth_token>' \
-H 'X-SmartShape-Session: <session_token>' \
-d '{
"title": "My updated snippet",
"description": "Snippet description",
"code": "array(array(\"Field 1\", \"Field 2\"), array(\"Field 1\", \"Field 2\"))",
"defaultExportFormat": "csv",
"supportedExportFormats": ["csv"]
"files": [
"5bcdb47d30746e179fd3dddc"
],
"id": "5bcdb7574a35dc3ac6509f9e"
}'


