Aller au contenu

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:
HTTP/1.1 200 OK
{
      "label": {
         "en_US": "Previous",
         "fr_FR": "Précédent"
      },
      "name": "Test name",
      "icon": "square",
      "matchQuery": "cube",
      "files": ["62f1149ddcdc5f002ee5bbaa"],
      "readPermissions": [],
      "writePermissions": [],
      "id": "6089543988bb2e000be0092e"
  }
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:
HTTP/1.1 200 OK
{
 "success": true,
 "actions": [
     {
         "label": "Test",
         "name": "Test name",
         "icon": "square",
         "matchQuery": "cube",
         "writePermissions": [],
         "readPermissions": [],
         "files": [
             "634831c6fbf84a002ea182b1"
         ],
         "id": "63483cc8e4bfd1049a73607c"
     }
  ]
}
Example usage:
curl -X GET 'https://smartshape.io/scene/action' \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \

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

Success-Response:
HTTP/1.1 200 OK
{
 "success": true,
 "action": "63483cc8e4bfd1049a73607c"
}
Example usage:
curl -X DELETE 'https://smartshape.io/scene/action/63483cc8e4bfd1049a73607c' \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \

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.

Success 200

Name Type Description
success boolean
Success-Response:
HTTP/1.1 200 OK
{
 "success": true
}
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",
  }'

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.

Success 200

Name Type Description
success boolean
Success-Response:
HTTP/1.1 200 OK
{
 "success": true
}
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",
  }'

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

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

Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
404

Not found

500

Internal Error

Error-Response:
HTTP/1.1 404 Not found
{
    "message": "Could not find ClippingBox 5ffeb4b3929b91061522ad35"
}
Example usage:
curl -X DELETE \
  https://smartshape.io/scene/clipping-box/5b72a7eb74f4ab7d20ef6f74 \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>'

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.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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/clipping-box/5b72a7eb74f4ab7d20ef6f74

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

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:
  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"
      }
  ]

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 id to delete

500

Internal Error

Example usage:
curl -X DELETE \
  https://smartshape.io/scene/clipping-plane/5b72a7eb74f4ab7d20ef6f74 \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \
  -d '["5b7e9cd04b121441d67c4bac", "5b7e9cd04b121441d67c4bad"]'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/clipping-plane/5b72a7eb74f4ab7d20ef6f74

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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
400

Bad Request

403

Forbidden

404

Not found

500

Internal Error

Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/58a5c4970bcb1a257712b99g'

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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
400

Bad Request

403

Forbidden

404

Not found

500

Internal Error

Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -F "nodes=58a5c4970bcb1a257712b99g;58a5c4970bcb1a257712b99b;58a5c4970bcb1a257712b99a" 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/'

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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true,
  "nodesAdded": 10
}

Error 4xx

Name Type Description
400

Bad Request

403

Forbidden

404

Not found

500

Internal Error

Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/?query=cube'

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 folders field.

data.permissions.readFolders Array

Permissions required to read the folders field.

data.permissions.writeOrder Array

Permissions required to modify the order field.

data.permissions.readOrder Array

Permissions required to read the order field.

data.permissions.writeColor Array

Permissions required to modify the color field.

data.permissions.readColor Array

Permissions required to read the color field.

data.permissions.writeName Array

Permissions required to modify the name field.

data.permissions.readName Array

Permissions required to read the name field.

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{"name":"Layer 1","color":1}' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/'

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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
403

Forbidden

404

Not found

500

Internal Error

Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/'

Get surface colors

Url: GET /scene/layer/colors/:file/

Parameter

Name Type Description
file String

File id

Success-Response:
HTTP/1.1 200 OK
{
   "data":[
      {
         "type":"surface",
         "id":"2afc45bb-257d-b273-7ab4-41b01b01164c",
         "attributes":{
            "subsurfaces":{
               "0": [6],
               "1": [6],
               "2": [6]
            }
         }
      },
      {
         "type":"surface",
         "id":"525768aa-20ea-79db-60b6-c78b13d53d1d",
         "attributes":{
            "subsurfaces":{
               "1": [2],
               "2": [1]
            }
         }
      }
   ]
}

Error 4xx

Name Type Description
404

Not found

500

Internal Error

Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/colors/587ca29dd564001b7cfc1196/?layers=58a492d6a20f5c201009750e;58a492d6a20f5c201009750a'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/'

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:
HTTP/1.1 200 OK
{
    "data": {
        "type": "node",
        "id": "5fff0c91509282115ec922cd",
        "uuid": "1bd73ebd-2fb2-2901-5d5b-2ee35fdc5565",
        "attributes": {
            "name": "cube_red_01",
            "file": "5fff0c90929b91061522d8f8",
            "layers": [
                "5fff15cad714320623e65afd"
            ],
            "ancestorLayers": []
        }
    }
}

Error 4xx

Name Type Description
404

Not found

500

Internal Error

Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layers/587ca29dd564001b7cfc1196/58a5c4970bcb1a257712b99a'

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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
400

Bad Request

403

Forbidden

404

Not found

500

Internal Error

Error-Response:
HTTP/1.1 404 Not Found
{
     "errors": [
         {
             "status": 404,
             "detail": "Layer not found.",
             "title": "Not Found"
         }
     ]
 }
Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/layer/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/58a5c4970bcb1a257712b99g'

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 folders field.

data.permissions.readFolders Array

Permissions required to read the folders field.

data.permissions.writeOrder Array

Permissions required to modify the order field.

data.permissions.readOrder Array

Permissions required to read the order field.

data.permissions.writeColor Array

Permissions required to modify the color field.

data.permissions.readColor Array

Permissions required to read the color field.

data.permissions.writeName Array

Permissions required to modify the name field.

data.permissions.readName Array

Permissions required to read the name field.

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -F "name=new name" -F "color=3" 'https://smartshape.io/scene/layer/update/587ca29dd564001b7cfc1196/58a492d6a20f5c201009750e/'

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:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a truthy or falsey value depending on if the Node Metadata applies to the Node or not.

tooltipQuery String optional

SmartShapeQL query that:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a string formatted in Markdown that will be the tooltip of the Node shown at different places in the UI.

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:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a truthy or falsey value depending on if the Node Metadata applies to the Node or not.

tooltipQuery String optional

SmartShapeQL query that:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a string formatted in Markdown that will be the tooltip of the Node shown at different places in the UI.

Success-Response:
HTTP/1.1 200 OK
{
    "matchQuery": "test",
    "tooltipQuery": "join(array(get(., \"name\"), \" is attached to an object made of \", @\"material\"))",
    "files": [
        "5de644b4bddb28460ef34400"
    ],
    "id": "5de685d4ef568153ab20c876"
}

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

Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
500

Internal Error

Example usage:
curl -X DELETE \
  https://smartshape.io/scene/node/metadata/5de685d4ef568153ab20c876 \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>'

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:
HTTP/1.1 200 OK
[
   {
       "tooltipQuery": "join(array(get(., \"name\"), \" is attached to an object made of \", @\"material\"))",
       "matchQuery": "test_updated",
       "files": [
           "5de644b4bddb28460ef34400"
       ],
       "id": "5de685d4ef568153ab20c876"
   }
]

Error 4xx

Name Type Description
500

Internal Error

Example usage:
curl -X GET \
  https://smartshape.io/scene/node/metadata/5de644b4bddb28460ef34400 \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>'

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:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a truthy or falsey value depending on if the Node Metadata applies to the Node or not.

tooltipQuery String optional

SmartShapeQL query that:

  • Is executed on each Node the Node Metadata applies to when doing a Node search.
  • Must return a string formatted in Markdown that will be the tooltip of the Node shown at different places in the UI.

Success 200

Name Type Description
object Object

The updated NodeMetadata

Success-Response:
HTTP/1.1 200 OK
{
    "matchQuery": "test_updated",
    "tooltipQuery": "join(array(get(., \"name\"), \" is attached to an object made of \", @\"material\"))",
    "files": [
        "5de644b4bddb28460ef34400"
    ],
    "id": "5de685d4ef568153ab20c876"
}

Error 4xx

Name Type Description
500

Internal Error

Example usage:
curl -X PUT \
  https://smartshape.io/scene/node/metadata \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "matchQuery": "test_updated"
  }'

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:
HTTP/1.1 200 OK
{
    "name": {
        "fr_FR": "Sélectionner le parent",
        "en_US": "Pick the parent"
    },
    "query": "@\"smartshape.scene.node.path|Shape\" && children:($smartshape.selected)",
    "icon": "file-tree",
    "sceneTreeIndex": 1,
    "files": [
        "5e42bba505dd2967ec30b7c4"
    ],
    "id": "5e42e3a35052e47ec97552c5"
}

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

Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
500

Internal Error

Error-Response:
HTTP/1.1 500 Internal Error
{
   "message": "Could not find NodeSelectionMode 5ffeb4b3929b91061522ad35"
}
Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/node-selection-mode/5e42e3a35052e47ec97552c5'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/node-selection-mode/5e42bba505dd2967ec30b7c4'

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:
HTTP/1.1 500 Internal Error
{
   "message": "Could not find NodeSelectionMode 5ffeb4b3929b91061522ad35"
}
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

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 point-point, axis-axis, axis-surface and surface-surface.

quotations.display String

The type of display of the quotation: distance or distance-and-components.

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.

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",
        "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"
     }
  ]

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",
      "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",
        "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"
    }
]

Error 4xx

Name Type Description
400

Missing argument

500

Internal Error

Example usage:
curl -X DELETE \
  https://smartshape.io/scene/quotation/5b72a7eb74f4ab7d20ef6f74 \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \
  -d '["5b7e9cd04b121441d67c4a5d"]'

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",
          "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"
      }
  ]

Error 4xx

Name Type Description
500

Internal Error

Example usage:
curl -X GET https://smartshape.io/scene/quotation/5b72a7eb74f4ab7d20ef6f74 \
    -H 'Authorization: Bearer <auth_token>' \
    -H 'X-SmartShape-Session: <session_token>'

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/render-style/apply/5bd854d3b45f427e98f2fa98/5bd854d7c925cb1c210e269b

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.
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

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
Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
404

Render style not found

500

Internal Error

Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/render-style/5bcdb7574a35dc3ac6509f9e

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/render-style/5b9691f80cd2e33c10463c43

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

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{ "attributes": { "5964f9e0435711191f0f9132": { "material": "metal" } } }' 'https://smartshape.io/scene/attributes/5964f9dfd350142ba6312bc4/'

Create an attribute metadata

Url: POST /scene/attribute/metadata/

Body

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.
textarea
- select: Shows a drop down menu which lets the user choose among the values of the parameters field.
select
- 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"].
checklist
- 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

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

Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
400

Missing argument

404

Not Found

500

Internal error

Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/attribute/metadata/5979d9fa29e961345ede5050/'

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:
HTTP/1.1 200 OK
{
    "data": [
        {
            "type": "attributeKey",
            "id": "5979e6bbe13d5c43058eb14a",
            "attributes": {
                "type": "select",
                "data": {
                    "values": [
                        "value1",
                        "value2"
                    ]
                }
            }
        }
    ]
}

Error 4xx

Name Type Description
500

Internal error

Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/attribute/metadata/5979d9fa29e961345ede5050/?key=Remarque'

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:
HTTP/1.1 200 OK
{
    "data": [
        {
            "type": "attributeKey",
            "id": "5979e6bbe13d5c43058eb14a",
            "attributes": {
                "type": "select",
                "data": {
                    "values": [
                        "value1",
                        "value2"
                    ]
                }
            }
        }
    ]
}

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 favorite for a saved search or history for a previously searched query

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' "https://smartshape.io/scene/search/list/

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/ancestors/587ca29dd564001b7cfc1196/58a5c4970bcb1a257712b99a/1'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/children/587ca29dd564001b7cfc1196/58a5c4970bcb1a257712b99a'

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:
HTTP/1.1 200 OK
{
   "data":{
      "texture_diffuse.jpg.texture": true,
      "texture_normal.jpg.texture": false
   }
}

Error 4xx

Name Type Description
404

Not found

500

Internal Error

Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/dependencies/587ca29dd564001b7cfc1196'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/surfaces/587ca29dd564001b7cfc1196/?query=*_cube'

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/surfaces/587ca29dd564001b7cfc1196/' -d '{"query": "q"}'

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:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' "https://smartshape.io/scene/search/delete/589cafda25996a19e0b2fe3b

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:
HTTP/1.1 200 OK
{
  "user": "test@smartshape.io.test",
  "type": "favorite",
  "context": "scene",
  "date": "2021-06-02T14:03:30.978Z",
  "search": "attribute:foo=bar",
  "name": "foobar",
  "id": "60b78fb28ed3236e8d7ffb47"
}

Error 4xx

Name Type Description
400

Bad Request

Example usage:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' -d '{"name": "foobar"}' 'https://smartshape.io/scene/search/save/?query=attribute:foo=bar'

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:
 HTTP/1.1 200 OK
 {
  "user": "test@smartshape.io.test",
  "type": "history",
  "context": "scene",
  "date": "2021-06-04T08:29:21.106Z",
  "search": "attribute:foo=bar",
  "name": "foobar",
  "id": "60b9e46140d8ae5cc2bfde38"
}

Error 4xx

Name Type Description
400

Bad Request

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 '{"name": "foobar"}' 'https://smartshape.io/scene/search/history/?query=attribute:foo=bar'

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:
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' 'https://smartshape.io/scene/search/587ca29dd564001b7cfc1196?exclude=attributes" -d '{ "queries": ["cube", "sphere'] }'
Example usage: Export the results as XLSX file.
curl -X POST -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' -H 'Content-Type: application/json' 'https://smartshape.io/scene/search/587ca29dd564001b7cfc1196?format=xlsx" -d '{ "queries": ["cube", "sphere'] }'

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

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

Success 200

Name Type Description
result String

JSON object of the new scene folder saved into the database

Success-Response:
HTTP/1.1 200 OK
{
     "name": "Important layers",
     "description": "A scene folder containing all the important layers",
     "files": ["5964f9dfd350142ba6312bc4"],
     "order": 1,
     "id": "5b9694a57192d23c24104980"
}

Error 4xx

Name Type Description
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 '{ "name": "Important layers", "files": ["5964f9dfd350142ba6312bc4"], "order": 1 }' 'https://smartshape.io/scene/folder/'

Delete scene folder

Url: DELETE /scene/folder/:folderId

Parameter

Name Type Description
folderId String

Scene folder id

Success 200

Name Type Description
success Boolean
Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
404

Scene folder not found

500

Internal Error

Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/folder/5b9694a57192d23c24104980

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"
     },
     {
         "name": "Second scene folder",
         "files": [
             "5b9691f80cd2e33c10463c43"
         ],
         "order": 2,
         "id": "5b9694b07192d23c24104981"
     }
  ]
Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/folder/5b9691f80cd2e33c10463c43

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

Success 200

Name Type Description
result Object

JSON object of the new scene folder saved into the database

Success-Response:
HTTP/1.1 200 OK
{
    "name": "Quite important layers",
    "order": 3,
    "files": ["5b9691f80cd2e33c10463c43"],
    "description": "The layers stored in this folder are of average utility",
    "id": "5b9694a57192d23c24104980"
}

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"
    }'

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
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

Success 200

Name Type Description
result String

JSON object of the created search form

Success-Response:
HTTP/1.1 200 OK
{
  "files": [
    "5ffebbd74507e30a9bfc61d5"
  ],
  "name": "Color",
  "searchQuery": "@color=$color",
  "fields": [
    {
      "type": "select",
      "name": "color",
      "label": "Color",
      "data": [
        "blue",
        "red"
      ]
    }
  ],
  "description": "Search by color",
  "readPermissions": [],
  "_id": "5ffec22516561a0958252bc2"
}

Error 4xx

Name Type Description
400

Missing argument

500

Internal Error

Error-Response:
HTTP/1.1 400 Bad Request
{
    "code": 400,
    "title": "Bad Request",
    "message": "Missing arguments"
}
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
Success-Response:
HTTP/1.1 200 OK
{
  "success": true
}

Error 4xx

Name Type Description
404

Not found

500

Internal Error

Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/search/form/5ffecdfb16561a0958252bc5'

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:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' 'https://smartshape.io/scene/search/form/5ffebbd74507e30a9bfc61d5'

Snippet

Create a Snippet

Url: POST /scene/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:
HTTP/1.1 500 Internal Error
{
    "status": 500,
    "message": "Something went wrong."
}
Error-Response:
HTTP/1.1 500 Internal Error
{
    "code": 500,
    "title": "Internal error",
    "message": "Snippet validation failed: code: Unexpected token ')' on line 1 column 25"
}
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

Parameter

Name Type Description
snippet String

Snippet id

Success 200

Name Type Description
success Boolean
Success-Response:
HTTP/1.1 200 OK
{
    "success": true
}

Error 4xx

Name Type Description
404

Snippet not found

500

Internal Error

Error-Response:
HTTP/1.1 404 Not found
{
    "code": 404,
    "title": "Not found",
    "message": "Snippet not found"
}
Example usage:
curl -X DELETE -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/snippet/5bcdb7574a35dc3ac6509f9e

Execute a Snippet

Url: POST /scene/snippet/execute/:file/: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

Success-Response:
HTTP/1.1 200 OK
{
    "result": "field1;field2\nValue1;Value2",
    "format": "csv"
}

Error 4xx

Name Type Description
400

Bad request

404

Not found

500

Internal Error

Error-Response:
HTTP/1.1 404 Not found
{
    "code": 404,
    "title": "Not found",
    "message": "Snippet not found"
}
Error-Response:
HTTP/1.1 400 Bad request
{
    "code": 400,
    "title": "Bad request",
    "message": "Format not supported by this snippet"
}
Example usage:
curl -X POST \
  https://smartshape.io/scene/snippet/execute/5bd854d3b45f427e98f2fa98/5bd854d7c925cb1c210e269b \
  -H 'Authorization: Bearer <auth_token>' \
  -H 'X-SmartShape-Session: <session_token>' \
  -H 'Content-Type: application/json' \
  -d '{
      "format": "csv",
      "variables": {}
  }'

List snippets

Url: GET /scene/snippet/:file

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:
HTTP/1.1 500 Internal Error
{
    "status": 500,
    "title": "Internal error",
    "message": "Something went wrong."
}
Example usage:
curl -X GET -H 'Authorization: Bearer <auth_token>' -H 'X-SmartShape-Session: <session_token>' https://smartshape.io/scene/snippet/5b9691f80cd2e33c10463c43

Update a Snippet

Url: PUT /scene/snippet/: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:
HTTP/1.1 200 OK
{
    "name": "My updated snippet",
    "headerQuery": "nth(array(\"Thickness\"),0)",
    "code": "@thickness",
    "format": "csv",
    "files": [
        "5bcdb47d30746e179fd3dddc"
    ],
    "id": "5bcdb7574a35dc3ac6509f9e"
}

Error 4xx

Name Type Description
404

Not found

500

Internal error

Error-Response:
HTTP/1.1 500 Internal Error
{
    "status": 500,
    "message": "Something went wrong."
}
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:
HTTP/1.1 404 Not found
{
    "code": 404,
    "title": "Not found",
    "message": "Snippet not found"
}
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"
 }'

February 22, 2024 February 22, 2024