Snuk Web Externals API documentation version v1
https://api.snuk.io
Snuk snunergy Web Externals API
Access Snuk API endpoints
/externals
The externals API
Get auth0 client token
Get auth0 client token
post /externals/{orgId}/auth/token
Get auth0 client token
URI Parameters
- orgId: required (string)
Headers
- Content-Type: required (string - pattern: application/json)
Body
Media type: application/json
Type: object
Properties- data: required (object)
- type: required (string - pattern: auth)
- attributes: required (object)
- clientId: required (string)
the client ID
- clientSecret: required (string)
the client secret
- clientId: required (string)
Example:
{
"data": {
"type": "auth",
"attributes": {
"clientId": "65t2319dI5GtRLX7gKKfd",
"clientSecret": "1wYrew87443a-4q311Yq7coPl77vXCIdFiI5jjQvB2Gff1o98P"
}
}
}HTTP status code 200
Headers
- Content-Type: (string - pattern: application/json)
Body
Media type: application/json
Type: object
Properties- access_token: required (string)
- expires_in: required (integer)
- token_type: required (string)
Example:
{
"access_token": "8Ty93cXWr54kPI1NiIsImtpZCI6IlJEQkJRakkygh38NbfORVV4TUVKRk16aEROekl4TkVJd05UZzBNMFUwTVRneFJFUXdNUSJ9.eyJpc3MiOiJodHRwczovL3NudWsuZflgkoXVD65Xr054sjfdsAWa45r89UFGTFg3MmxNYjB2QGNsaWVudHMiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQwMDAvIiwiaWF0IjoxNTM5MDc4MTg5LCJleHAiOjE1MzkxNjQ1ODksImF6cCI6IlhRUUY3SktYY1NseEkxOWRJSE56WUFGTFg3MmxNYjB2IiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.UzN3r70vB6YfDoUgu0pG7-Gq2iCF9qlhuvSryqYWTO-Gq9HuirBmQESQFxUFfDPGhOn7-LENYj1CvL9A5J3w-1a8wRD3ptuD4s8Y3EurlN6KTdoJ-yL85z45Q4PJqAYnCvByk9cw-ijq68o06fAHMiAbhrf7uUjU2F1Up6XhiHCYf_TJvtR5x4v1rQjC_9LFiYsE3uz9VLiqW9D49bb7T15GD1S7Tqlcv4mh9duxJBwhzGsX-T_s20Q0DO9vlFrjxezPKZEybbdWsIhUs-tXe8mvT2ujLahcuAPBpvac8wH72NhnGFgA7Wt-I7xQKujGjpHrYPZ9gGJkhO4t_cLHEA",
"expires_in": 86400,
"token_type": "Bearer"
}Get machines info.
get /externals/{orgId}/machines
Get machines info.
Snuk supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- orgId: required (string)
HTTP status code 200
Headers
- Content-Type: (string - pattern: application/json)
Body
Media type: application/json
Type: object
Properties- data: (object)
- type: (string - pattern: machines)
- attributes: required (object)
- machineInfo: (object)
- id: (string)
The machine ID.
- devideId: (string)
The device ID.
- fullName: (string)
The machine full name.
- shortName: (string)
The machine short name.
- hall: (string)
The hall that this machines is at.
- organisationId: (string)
The organisation ID.
- state: (string)
The state of the machine.
- metaData: (object)
Possible metadata.
- currentState: (string)
The current machine state (green, yellow or red).
- createdOn: (string)
When the machine was created.
- modifiedOn: (string)
When the machine was modified.
- id: (string)
- machineInfo: (object)
Example:
{
"data": {
"type": "machines",
"attributes": {
"machinesInfo": [
{
"id": "5102883729047552",
"shortName": "C9",
"state": "new",
"createdOn": "2018-08-09T11:30:12.177Z",
"metadata": {
"machineId": "10105180",
"location": "xzy"
},
"fullName": "Closs 9",
"deviceId": "02-02-03-000007",
"modifiedOn": "2018-08-09T11:30:12.291Z",
"organisationId": "5630121163620352",
"currentState": "green",
"hall": "F48"
},
{
"id": "5649050225344512",
"hall": "F48",
"shortName": "OS3",
"state": "new",
"alarmId": "5177366045261824",
"createdOn": "2018-08-09T11:27:38.990Z",
"fullName": "Orbital Schweissanlage 3",
"metadata": {
"machineId": "10105195",
"location": "xzy"
},
"deviceId": "02-02-03-000003",
"modifiedOn": "2018-08-09T11:27:39.102Z",
"organisationId": "5630121163620352",
"currentState": "red"
},
{
"id": "5652161459388416",
"hall": "F48",
"shortName": "C4",
"state": "new",
"alarmId": "5689413791121408",
"createdOn": "2018-08-09T11:31:22.205Z",
"metadata": {
"machineId": "10109320",
"location": "xzy"
},
"fullName": "Closs 4",
"deviceId": "02-02-03-000010",
"modifiedOn": "2018-08-09T11:31:22.326Z",
"organisationId": "5630121163620352",
"currentState": "red"
}
]
}
}
}Secured by oauth_2_0
Headers
- Authorization: required (string)
Used to send a valid OAuth 2 access token.
HTTP status code 401
Bad or expired token. This can happen if the user or Snuk revoked or expired an access token. To fix, re-authenticate the user.
HTTP status code 403
Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...). Unfortunately, re-authenticating the user won't help here.
Get machine info
get /externals/{orgId}/machines/{machineId}
Get machine info
Snuk supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- orgId: required (string)
- machineId: required (string)
HTTP status code 200
Headers
- Content-Type: (string - pattern: application/json)
Body
Media type: application/json
Type: object
Properties- data: (object)
- type: (string - pattern: machines)
- attributes: required (object)
- machineInfo: (object)
- id: (string)
The machine ID.
- devideId: (string)
The device ID.
- fullName: (string)
The machine full name.
- shortName: (string)
The machine short name.
- hall: (string)
The hall that this machines is at.
- organisationId: (string)
The organisation ID.
- state: (string)
The state of the machine.
- metaData: (object)
Possible metadata.
- currentState: (string)
The current machine state (green, yellow or red).
- createdOn: (string)
When the machine was created.
- modifiedOn: (string)
When the machine was modified.
- id: (string)
- machineInfo: (object)
Example:
{
"data": {
"type": "machines",
"attributes": {
"machineInfo": {
"id": "5102883729047552",
"deviceId": "02-02-03-000007",
"modifiedOn": "2018-08-09T11:30:12.291Z",
"organisationId": "5630121163620352",
"currentState": "green",
"hall": "F48",
"shortName": "C9",
"state": "new",
"createdOn": "2018-08-09T11:30:12.177Z",
"metadata": {
"location": "xzy",
"machineId": "10105180"
},
"fullName": "Closs 9"
}
}
}
}Secured by oauth_2_0
Headers
- Authorization: required (string)
Used to send a valid OAuth 2 access token.
HTTP status code 401
Bad or expired token. This can happen if the user or Snuk revoked or expired an access token. To fix, re-authenticate the user.
HTTP status code 403
Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...). Unfortunately, re-authenticating the user won't help here.
The machine metrics
Get machine metrics.
get /externals/{orgId}/machines/{machineId}/telemetry
Get machine metrics.
Snuk supports OAuth 2.0 for authenticating all API requests.
URI Parameters
- orgId: required (string)
- machineId: required (string)
Query Parameters
- period: (one of day, week, month)
Get all the data based on a specific time range. One of time or timestamp needs to be defined. Priority is given to timestamp.
- timestamp: (integer)
Get data from this timestamp to now. One of time or timestamp needs to be defined. Priority is given to timestamp.
HTTP status code 200
Headers
- Content-Type: (string - pattern: application/json)
Body
Media type: application/json
Type: object
Properties- data: (object)
- type: (string - pattern: machineData)
- attributes: required (object)
- machineData: (array of object)
Items: items
- id: (string)
The datapoint ID.
- timestamp: (integer)
When the datapoint was created (in ms).
- green: (integer)
Green color (0 - 1).
- yellow: (integer)
Yellow color (0 - 1).
- red: (integer)
Red color (0 - 1).
- id: (string)
- machineData: (array of object)
Example:
{
"data": {
"type": "machineData",
"attributes": {
"machineData": [
{
"id": "60b2a9c5-83ff-430b-811c-b38d317f676e",
"yellow": 0,
"red": 1,
"timestamp": 1538644828028,
"green": 0
},
{
"id": "7592c036-3246-442b-9453-b8a1c4164d7e",
"timestamp": 1538644837391,
"green": 1,
"yellow": 0,
"red": 0
},
{
"id": "aae64ee3-aae2-4376-a62b-c0bce202af81",
"timestamp": 1538644877140,
"green": 1,
"yellow": 0,
"red": 0
}
]
}
}
}Secured by oauth_2_0
Headers
- Authorization: required (string)
Used to send a valid OAuth 2 access token.
HTTP status code 401
Bad or expired token. This can happen if the user or Snuk revoked or expired an access token. To fix, re-authenticate the user.
HTTP status code 403
Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...). Unfortunately, re-authenticating the user won't help here.