Scene API
Action¶
Add an action¶
POST /action¶
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) |
Example usage:
curl -X PUT 'https://smartshape.io/scene/action' \
-H 'Authorization: Bearer <auth_token>' \
--data '{
"label": {
"en_US": "Previous",
"fr_FR": "Précédent"
},
"name": "Test name",
"icon": "square",
"matchQuery": "cube",
"files": ["62f1149ddcdc5f002ee5bbaa"],
"readPermissions": [],
"writePermissions": [],
}'
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
object | Object | The action created. |
List actions.¶
Parameter /action/:fileId?¶
Name | Type | Description |
---|---|---|
fileId | String | The id of the file to list actions on (optional). |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
success | boolean | |
actions | String | The actions of the file |
Remove action¶
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | boolean | |
action | String | The action id deleted |
Revert an action.¶
Parameter /action/revert/:file¶
Name | Type | Description |
---|---|---|
file | String | The id of the file on which the action is triggered. |
POST /action/revert/:file¶
Name | Type | Description |
---|---|---|
nodeIds | String[] | The nodes on which the action will be reverted. |
actionId | String | The id of the action to revert. |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | boolean |
Trigger an action.¶
Parameter /action/trigger/:fileId¶
Name | Type | Description |
---|---|---|
file | String | The id of the file on which the action is triggered. |
POST /action/trigger/:fileId¶
Name | Type | Description |
---|---|---|
nodeIds | String[] | The nodes on which the action will be triggered. |
actionId | String | The id of the action to trigger. |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | boolean |
NodeSelectionMode¶
Create a NodeSelectionMode¶
POST /scene/node-selection-mode/¶
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. |
Example usage:
curl -X POST 'https://smartshape.io/scene/node-selection-mode/' \
-H 'Authorization: Bearer <auth_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
}'
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
object | Object | The created NodeSelectionMode |
Request:
Request:
curl -X POST 'https://smartshape.io/scene/node-selection-mode/' \
-H "Authorization: Bearer <auth_token>" \
-H 'Content-Type: application/json' \
--data '{
"files": ["5e42bba505dd2967ec30b7c4"],
"name": {
"en_US": "Pick the parent",
"fr_FR": "Sélectionner le parent"
},
"icon": "file-tree",
"sceneTreeIndex": 1
}'
Error-response:
HTTP/1.1 500 Internal Server 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"
}
}
Delete an NodeSelectionMode¶
Parameter /scene/node-selection-mode/:nodeSelectionMode¶
Name | Type | Description |
---|---|---|
nodeSelectionMode | String | The id of the NodeSelectionMode to remove |
Example usage:
Request: curl -X DELETE -H 'Authorization: Bearer <auth_token>' 'https://smartshape.io/scene/node-selection-mode/5e42e3a35052e47ec97552c5'
List the NodeSelectionModes¶
Parameter /scene/node-selection-mode/:file¶
Name | Type | Description |
---|---|---|
file | String | The file id the listed NodeSelectionModes must be restricted to |
Example usage:
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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
objects | [Object] | The NodeSelectionModes |
Update an NodeSelectionMode¶
Parameter /scene/node-selection-mode/:nodeSelectionMode¶
Name | Type | Description |
---|---|---|
nodeSelectionMode | String | The id of the NodeSelectionMode to update |
POST /scene/node-selection-mode/:nodeSelectionMode¶
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. |
Example usage:
curl -X PUT 'https://smartshape.io/scene/node-selection-mode/5e42e3a35052e47ec97552c5' \
-H 'Authorization: Bearer <auth_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)"
}'
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"
}
Success 200¶
Name | Type | Description |
---|---|---|
object | Object | The updated NodeSelectionMode |
Request: curl -X PUT 'https://smartshape.io/scene/node-selection-mode/5e42e3a35052e47ec97552c5' \
-H 'Authorization: Bearer <auth_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)"
}'
Error-response:
HTTP/1.1 500 Internal Server Error
{
"message": "Could not find NodeSelectionMode 5ffeb4b3929b91061522ad35"
}
Scene¶
Add a node to a layer¶
Parameter /scene/layer/:file/:layer/:nodeId¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
GET /scene/layer/:file/:layer/:nodeId¶
Name | Type | Description |
---|---|---|
nodeId | String | Id of the node to add to the layer |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Add nodes to a layer¶
Parameter /scene/layer/:file/:layer/¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
POST /scene/layer/:file/:layer/¶
Name | Type | Description |
---|---|---|
nodes | String | List of nodes, separated by ";" |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Add or update node attributes¶
Parameter /scene/attributes/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/attributes/:file¶
Name | Type | Description |
---|---|---|
JSON | json | object describing the attributes to add or update |
Example usage:
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": {}
}
]
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the updated nodes |
Add query result to layer¶
Parameter /scene/layer/:file/:layer/?query=my_query¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
GET /scene/layer/:file/:layer/?query=my_query¶
Name | Type | Description |
---|---|---|
query | String | Query to add to the layer. Nodes found with this query will be added to layer |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Apply a render style¶
Parameter /scene/render-style/apply/:file/:renderStyle¶
Name | Type | Description |
---|---|---|
renderStyle | String | Render style id |
POST /scene/render-style/apply/:file/:renderStyle¶
Name | Type | Description |
---|---|---|
variables | Object | Search variables |
Example usage:
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"
}
}
}
}
}
}
Success 200¶
Name | Type | Description |
---|---|---|
A | Object | JSON object with the surfaces corresponding to every color index and the associated legend formatted labels |
Create a Snippet¶
POST /scene/snippet/¶
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.Allowed values: "csv","json" |
supportedExportFormats | String | Supported exports formats when executing the snippet |
Example usage:
curl -X POST \
https://smartshape.io/scene/snippet \
-H 'Authorization: Bearer <auth_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": []
}'
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"
}
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the new Snippet saved into the database |
Error-Response:
Create a layer¶
Parameter /scene/layer/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/layer/:file¶
Name | Type | Description |
---|---|---|
name | String | Layer name |
color | Number | Color palette index |
order | Number | optional Value used to sort layers when listed |
Example usage:
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"
}
Success 200¶
Name | Type | Description |
---|---|---|
id | String | new Layer id |
Create a render style¶
POST /scene/render-style/¶
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. The result of this query is used by legendQuery and orderQuery to compute the label shown in the legend and the order of the colors in the legend.When all the nodes of the same index produce the same value, only one legend is shown for each color. When at least one node of a given index produces a value different of the other nodes of the same index, the min value and max value for this index are both shown in the legend, separated by a dash like: "18 mm - 20 mm" |
indexQuery | String | Executed on: all the nodes of the scene. Determines which color index (in the color palette) a node will be colored with. Each distinct index will produce a new line in the legend |
legendQuery | String | optional Executed on: the nodes with the smallest and highest value of each index. The legend query must return a formatted string to customize the label displayed next to each color in the legend. When not provided, the values of valueQuery are shown instead. |
orderQuery | String | optional Executed on: the node with the smallest value of each index. Color indexes are sorted in ascending order in the legend (in lexicographic order in case of String values). If no orderQuery is provided, the colors are sorted by ascending order based on the minimum value of each legend color.If orderQuery is provided, colors in the legend are sorted according to the results returned by orderQuery executed on the node with the lowest value of each legend color |
Example usage:
curl -X PUT \
https://smartshape.io/scene/render-style \
-H 'Authorization: Bearer <auth_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\")"
}'
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"
}
Success 200¶
Name | Type | Description |
---|---|---|
body | Object | JSON object of the new render style saved into the database |
Create a scene folder¶
POST /scene/folder/¶
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 |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the new scene folder saved into the database |
Create a search form¶
POST /scene/search/form/¶
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 Possible values: - textinput: Shows a text area which allows the user to enter any string - select: Shows a drop down menu which lets the user choose among the values of the fields.data field- number: Shows a number selector which lets the user to enter a valid number - switch: Shows a switch which allows the user to enable or disable it |
fields.data | [String] | optional Values showed in the drop down menu when the type is select |
readPermissions | [String] | optional Permissions required to read this search form |
Example usage:
curl -X POST -H 'Authorization: Bearer <auth_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/'
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the created search form |
Error-Response:
Create an attribute metadata¶
POST /scene/attribute/metadata/¶
Name | Type | Description |
---|---|---|
key | String | Determines which attributes this attribute metadata applies to. This key must match the key of the attribute it applies to |
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. Possible values: - textarea: Shows a text area which allows the user to enter any string. ![]() - select: Shows a drop down menu which lets the user choose among the values of the parameters field.![]() - checklist: Shows a list of toggles according to the values of the parameters field. The attribute's value then contains an array which contains every value that was toggled on. Here, the attribute's value will be ["Completed"] .![]() - number: Shows a number selector which lets the user to enter a valid number contained between editor.min and editor.max and that can be incremented by steps of editor.step .- picture: Shows a button that allows the user to take a picture. The resulting picture is stored in the attribute as a base64 string. (Only available on Android devices.) |
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 : - If the query returns -1 then the Attribute is valid and the user can validate its changes.- If the query returns a number greater than -1 , the message at the corresponding index in AttributeMetadata.validator.messages is shown to the user. Note that the query can access two variables : - $current containing the node without the new value of the Attribute - $incoming containing the node with the new value of the Attribute |
validator.messages | [Object] | optional Messages to be displayed in the UI in case AttributeMetadata.validator.query returns an index greater than -1 |
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 |
Example usage:
curl -X POST \
https://smartshape.io/scene/attribute/metadata/ \
-H 'Authorization: Bearer <auth_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"
}
}
]
}
}'
Success-Response:
HTTP/1.1 200 OK
{
"data": [
{
"type": "attributeMetadata",
"id": "5f36a990e21f4d05de55f2dc",
"attributes": {
"key": "Remarque",
"editor": {
"type": "select",
"_id": "5f36a990e21f4d05de55f2dd",
"updateOnlyQuery": "false",
"parameters": [
"value1",
"value2"
]
},
"validator": {
"query": "(apply($incoming, @\"material\"=\"metal\") && nth(array(-1), 0)) || nth(array(0), 0)",
"messages": [
{
"level": 3,
"message": {
"fr_FR": "Message d'erreur en français",
"en_US": "Error message in english"
}
}
]
},
"writePermissions": [],
"readPermissions": [],
"files": [],
"order": null,
"id": "5f36a990e21f4d05de55f2dc"
}
}
]
}
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the new attribute metadata saved into the database |
Create or update clipping plane(s)¶
Parameter /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of clipping planes to create or update. |
clipping-plane.0.name | String | The name of the clipping plane |
clipping-plane.0.colorId | int | The id of the color used for the clipping plane |
clipping-plane.0.equation | Equation | Equation of the clipping plane surface |
clipping-plane.0.equation.x | float | x value of the equation |
clipping-plane.0.equation.y | float | y value of the equation |
clipping-plane.0.equation.z | float | z value of the equation |
clipping-plane.0.equation.w | float | distance value of the equation |
Example usage:
curl -X POST \
https://smartshape.io/scene/clipping-plane/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_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 'Content-Type: application/json' \
-d '[{
"_id", "5b7e9cd04b121441d67c4bad",
"name": "Updated clipping plane name",
"colorId": 4,
"equation": {
"x": 2,
"y": 2,
"z": 1,
"w": 0.5
}
}]'
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"
}
]
HTTP/1.1 200 OK
[
{
"name": "Updated clipping plane name",
"colorId": 0,
"equation": {
"x": 0,
"y": 0,
"z": 1,
"w": 0.5
},
"file": "5ffeb4b3929b91061522ad35",
"id": "5fff0299d714320623e65ae8"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the created or updated clipping plane(s) |
Create or update quotation(s)¶
Parameter /scene/quotation/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/quotation/:file¶
Name | Type | Description |
---|---|---|
quotations | [Object] | Array of quotations to create or update. |
quotations.0.id | String | optional The id of the quotation to update. The request will create the quotation if no id is provided. |
quotations.0.name | String | The name of the quotation. |
quotations.0.colorId | Number | The id of the color in which the quotation will be displayed. |
quotations.0.type | String | The type of the quotation, among point-point , axis-axis , axis-surface and surface-surface . |
quotations.0.display | String | The type of display of the quotation: distance or distance-and-components . |
quotations.0.quotationPoints | Object | The quotation points, each one represented by a triplet of vec3 (x, y, z). |
quotations.0.quotationPoints.0.pickingPoint | Object | The point of the model where the user clicked. |
quotations.0.quotationPoints.0.pickingNormal | Object | The normal of the model at the point where the user clicked. |
quotations.0.quotationPoints.0.measurePoint | Object | The point actually used to perform the measure. |
quotations.0.readPermissions | [String] | optional An array of the permissions needed to have read acess to the quotation. |
quotations.0.writePermissions | [String] | optional An array of the permissions needed to have write acess to the quotation. |
Example usage:
curl -X POST \
https://smartshape.io/scene/quotation/5b72a7eb74f4ab7d20ef6f74 \
-H 'Authorization: Bearer <auth_token>' \
-d '[
{
"name":"First quotation",
"colorId":0,
"type":"point-point",
"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
}
}
}
}
]
}
]'
Success-Response:
HTTP/1.1 200 OK
[
{
"name":"Quotation 1",
"colorId":0,
"type":"point-point",
"display":"distance-and-components",
"unit": "auto",
"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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the created or updated quotation(s) |
Delete a Snippet¶
Parameter /scene/snippet/:snippet¶
Name | Type | Description |
---|---|---|
snippet | String | Snippet id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
A | Object | JSON object with a success field set to true |
Error-Response:
Delete a layer¶
Parameter /scene/layer/:file/:layer¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Delete a render style¶
Parameter /scene/render-style/:renderStyle¶
Name | Type | Description |
---|---|---|
renderStyle | String | Render style id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
A | Object | JSON object with a success field set to true |
Delete a search form¶
Parameter /scene/search/form/:searchform¶
Name | Type | Description |
---|---|---|
searchform | String | Search Form _id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Delete an attribute metadata¶
Parameter /scene/attribute/metadata/:attributeMetadata¶
Name | Type | Description |
---|---|---|
AttributeMetadata | String | optional Attribute metadata id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
result | Object | A JSON object with a success field set to true |
Delete clipping plane(s)¶
Parameter /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
body | [String] | Array of clipping planes id to delete. |
Example usage:
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 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the removed clipping plane(s) |
Delete quotation(s)¶
Parameter /scene/quotation/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/quotation/:file¶
Name | Type | Description |
---|---|---|
body | [String] | Array of quotation id to delete. |
Example usage:
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "Quotation 1",
"colorId": 0,
"type": "point-point",
"display": "distance-and-components",
"unit": "auto",
"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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the removed quotation(s) |
Delete scene folder¶
Parameter /scene/folder/:folderId¶
Name | Type | Description |
---|---|---|
folderId | String | Scene folder id |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
A | Object | JSON object with a success field set to true |
Execute a Snippet¶
Parameter /scene/snippet/execute/:file/:snippet¶
Name | Type | Description |
---|---|---|
file | String | File id |
snippet | String | Snippet id |
POST /scene/snippet/execute/:file/:snippet¶
Name | Type | Description |
---|---|---|
variables | Object | optional Search variables |
format | Object | Format used to export the result of the execution of the snippet |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
A | Object | JSON object with its result field set to the result of the execution and format field set to the requested format. |
Error-Response:
Error-Response:
Get attribute(s) metadata¶
Parameter /scene/attribute/metadata/:file/¶
Name | Type | Description |
---|---|---|
file | String | optional File id |
GET /scene/attribute/metadata/:file/¶
Name | Type | Description |
---|---|---|
key | String | optional Attribute name |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
key | Object | Attribute metadata object(s) |
Get common attributes for a nodes list¶
Parameter /scene/attributes/common/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/attributes/common/:file¶
Name | Type | Description |
---|---|---|
JSON | json | object containing a query filtering the nodes |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the common attributes of all nodes |
Get surface colors¶
Parameter /scene/layer/colors/:file/?layers=:layers¶
Name | Type | Description |
---|---|---|
file | String | File id |
GET /scene/layer/colors/:file/?layers=:layers¶
Name | Type | Description |
---|---|---|
layers | String | Layer ids to filter, separated by ";" (optional) |
Example usage:
Success-Response:
List clipping plane(s)¶
Parameter /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/clipping-plane/:file¶
Name | Type | Description |
---|---|---|
Array | [body] | of the clipping plane(s) to add or update |
Example usage:
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 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the clipping plane(s) that belongs to the specified file |
List file searches¶
Example usage:
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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
id | String | Search id |
name | String | Search name (for favorited searches only) |
search | String | Search query |
type | String | Either favorite for a saved search or history for a previously searched query |
date | String | Date when the query was run or saved |
List layers¶
Parameter /scene/layer/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
Example usage:
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
}
}
]
}
Success 200¶
Name | Type | Description |
---|---|---|
data | Object | Layer list |
List node ancestors¶
Parameter /scene/ancestors/:file/:nodeId/:sceneTreeIndex¶
Name | Type | Description |
---|---|---|
file | String | File id |
nodeId | String | Node id or uuid |
SceneTreeIndex | Int | Index of the scene tree |
Example usage:
Success-Response:
HTTP/1.1 200 OK
{
"data": [
{
"type": "node",
"id": "58a5c4970bcb1a257712b99f",
"uuid": "2e36584e-67e3-4dec-6821-51df55b12210",
"attributes": {
"name": "node name",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 3,
"numAttributes": 10,
"parent": null
}
},
{
"type": "node",
"id": "58a5c4970bcb1a257712b99g",
"uuid": "594313d0-36e2-2488-7a4d-5f56615a4fbe",
"attributes": {
"name": "node name 2",
"file": "587ca29dd564001b7cfc1196",
"numChildren": 0,
"numAttributes": 10,
"parent": "2e36584e-67e3-4dec-6821-51df55b12210"
}
}
]
}
Success 200¶
Name | Type | Description |
---|---|---|
node | Object | Root node |
children | Array | Root node children |
List node children¶
Parameter /scene/children/:file/:nodeId¶
Name | Type | Description |
---|---|---|
file | String | File id |
nodeId | String | Node id or uuid |
query string /scene/children/:file/:nodeId¶
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 |
Example usage:
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]
}
}
]
}
}
Success 200¶
Name | Type | Description |
---|---|---|
node | Object | Root node |
children | Array | Root node children |
List node layers¶
Parameter /scene/layers/:file/:nodeId¶
Name | Type | Description |
---|---|---|
file | String | File id |
nodeId | String | Node id or uuid |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
node | Object | Root node |
children | Array | Root node children |
List original nodes for a list of surfaces¶
Parameter /scene/nodes/:file/¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/nodes/:file/¶
Name | Type | Description |
---|---|---|
data | String | Query as a JSON object. |
Example usage:
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
}
}
]
}
}
}
}
]
List quotation(s)¶
Parameter /scene/quotation/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
Example usage:
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "Quotation 1",
"colorId": 0,
"type": "point-point",
"display": "distance-and-components",
"unit": "auto",
"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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the quotation(s) that belongs to the specified file |
List render styles¶
Parameter /scene/render-style/:file¶
Name | Type | Description |
---|---|---|
file | String | File id (optional) |
Example usage:
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"
}
]
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. |
List scene dependencies status¶
Lists scene dependencies and whether they're present or not
Parameter /scene/dependencies/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
Example usage:
Success-Response:
List scene folders¶
Parameter /scene/folder/:file¶
Name | Type | Description |
---|---|---|
file | String | optional File id |
Example usage:
Success-Response:
HTTP/1.1 200 OK
[
{
"name": "First scene folder",
"description": "A folder for beheviors",
"files": [
"5b9691f80cd2e33c10463c43"
],
"order": 1,
"id": "5b9694a57192d23c24104980"
},
{
"name": "Second scene folder",
"files": [
"5b9691f80cd2e33c10463c43"
],
"order": 2,
"id": "5b9694b07192d23c24104981"
}
]
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. |
List search forms¶
Parameter /scene/search/form/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
Example usage:
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"
]
}
]
}
]
}
List snippets¶
Parameter /scene/snippet/:file¶
Name | Type | Description |
---|---|---|
file | String | optional File id |
Example usage:
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"
}
]
Success 200¶
Name | Type | Description |
---|---|---|
body | [Object] | Array of the snippets that belong to the specified file if given, or all the snippets otherwise. |
Error-Response:
List surfaces for a search query¶
Parameter /scene/surfaces/:file/?query=:query¶
Name | Type | Description |
---|---|---|
file | String | File id |
query | String | Search query |
Example usage:
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"
}
}
}
}
}
}
}
Success 200¶
Name | Type | Description |
---|---|---|
id | String | Export surface id |
attributes | Object | Containing the list of subsurfaces in the export surface |
List surfaces for a search query (POST)¶
POST /scene/surfaces/:file/?query=:query¶
Name | Type | Description |
---|---|---|
queries | [String] | Search queries |
searchQueriesAst | [Bool] | Return the AST of the search queries. Defaults to true. |
Example usage:
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"
}
}
}
}
}
}
}
Success 200¶
Name | Type | Description |
---|---|---|
id | String | Export surface id |
attributes | Object | Containing the list of subsurfaces in the export surface |
Remove a node from a layer¶
Parameter /scene/layer/:file/:layer/:nodeId¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
GET /scene/layer/:file/:layer/:nodeId¶
Name | Type | Description |
---|---|---|
nodeId | String | Id of the node to add to the layer |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
HTTP1.1 404 Not Found
Remove a scene search query from favorites¶
Parameter /scene/search/delete/:searchId¶
Name | Type | Description |
---|---|---|
searchId | String | Id of the search to remove |
Example usage:
Save a scene search query to favorites¶
GET /scene/search/save/?q=:query¶
Name | Type | Description |
---|---|---|
query | String | Query to save |
POST /scene/search/save/?q=:query¶
Name | Type | Description |
---|---|---|
name | String | Name to save the query with |
Example usage:
Success-Response:
Search nodes¶
Parameter /scene/search/:file/¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/search/:file/¶
Name | Type | Description |
---|---|---|
queries | [String] | Search queries |
GET /scene/search/:file/¶
Name | Type | Description |
---|---|---|
exclude | String | optional Comma separated list of node properties to exclude from the result (examples of properties: 'attributes', 'layerColors') |
format | String | optional Format to export the results in. Formats available: - csv - json - xlsx - xml |
Example usage:
Example usage: Export the results as XLSX file.
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"
}
}
}
}
}
}
}
Update a Snippet¶
POST /scene/snippet/:snippet¶
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.Allowed values: "csv","json" |
supportedExportFormats | String | Supported exports formats when executing the snippet |
Example usage:
curl -X PUT \
https://smartshape.io/scene/snippet/5bcdb7574a35dc3ac6509f9e \
-H 'Authorization: Bearer <auth_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"
}'
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
result | String | JSON object of the updated Snippet |
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:
Update a layer¶
Parameter /scene/layer/update/:file/:layer¶
Name | Type | Description |
---|---|---|
file | String | File id |
layer | String | Layer id |
POST /scene/layer/update/:file/:layer¶
Name | Type | Description |
---|---|---|
name | String | Layer name (optionnal) |
color | Number | Color palette index (optionnal) |
Example usage:
Success 200¶
Name | Type | Description |
---|---|---|
success | Bool |
Update a render style¶
Parameter /scene/render-style/:renderStyle¶
Name | Type | Description |
---|---|---|
renderStyle | String | Render style Id |
POST /scene/render-style/:renderStyle¶
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) |
Example usage:
curl -X POST https://smartshape.io/scene/render-style/5bcdb7574a35dc3ac6509f9e \
-H 'Authorization: Bearer <auth_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\")"
}'
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"
}
Success 200¶
Name | Type | Description |
---|---|---|
The | Object | updated render style |
Update a scene folder¶
Parameter /scene/folder/:folder¶
Name | Type | Description |
---|---|---|
folder | String | Scene folder id |
POST /scene/folder/:folder¶
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 |
Example usage:
Success-Response:
Success 200¶
Name | Type | Description |
---|---|---|
result | Object | JSON object of the new scene folder saved into the database |
Validate attributes update¶
Parameter /scene/attribute/validate/:file¶
Name | Type | Description |
---|---|---|
file | String | File id |
POST /scene/attribute/validate/:file¶
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 |
Example usage:
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"
]
}
]
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 |
April 27, 2023
April 27, 2023