Webhook API
Webhook¶
Add a webhook¶
Url: PUT
/webhook/
Permissions: write_webhook
Body¶
Name | Type | Description |
---|---|---|
event | String | Kind of event the webhook should react to. |
url | String | URL that will be called when the Webhook is triggered |
secretToken | String | Secret token that will be sent with each hook request in the |
Success-Response:
Error 4xx¶
Name | Type | Description |
---|---|---|
400 | Missing argument |
|
503 | Unauthorized |
Error-Response:
annotation_updated
webhook payload example:
{
file: '5c6aeed079bf3f432d3c929e',
event: 'annotation_updated',
data:
{
old:
{
targets: [],
tags: [],
readPermissions: [],
writePermissions: [],
permissions: [Object],
__v: 0,
author: 'test@smartshape.io',
file: '5c6aeed079bf3f432d3c929e',
lastUpdate: 1550826341717,
date: 1550826341717,
type: 0,
content: 'DESCRIPTION',
color: '#fff',
cameraZ: 3.394551,
cameraY: 1.988481,
cameraX: 3.394551,
name: 'test1',
_id: '5c6fbb654fb090280ecc926b'
},
new:
{
targets: [],
tags: [],
readPermissions: [],
writePermissions: [],
permissions: [Object],
__v: 0,
author: 'test@smartshape.io',
file: '5c6aeed079bf3f432d3c929e',
lastUpdate: 1550826341717,
date: 1550826341717,
type: 0,
content: 'DESCRIPTION',
color: '#fff',
cameraZ: 3.394551,
cameraY: 1.988481,
cameraX: 3.394551,
name: 'TITLE3',
_id: '5c6fbb654fb090280ecc926b'
}
},
owner: 'test@smartshape.io',
runTimestamp: 1550826412941,
uuid: 'a90c85c3-fa3e-4a88-be6f-8c1270c4c27b'
}
Example usage:
Delete a webhook¶
Url: DELETE
/webhook/:webhook/
Permissions: write_webhook
Parameter¶
Name | Type | Description |
---|---|---|
webhook | String | Webhook id |
Success 200¶
Name | Type | Description |
---|---|---|
success | Boolean |
Error 4xx¶
Name | Type | Description |
---|---|---|
404 | Not found |
|
503 | Unauthorized |
Example usage:
List webhooks¶
Url: GET
/webhook/
Permissions: read_webhook
Success-Response:
HTTP/1.1 200 OK
{
"data": [
{
"type": "webhook",
"id": "5988925c2dd3f45c740fdf2f",
"attributes": {
"event": "attribute_updated",
"url": "https://www.example.com/webhook/",
"secretToken": "$2a$10$HozKzQ5mDQ.haoTWDK3Nm.chd729rExtQLiTRoDtGQlWr4/Uh.2PS",
"owner": "test@smartshape.io"
}
},
{
"type": "webhook",
"id": "598894c09fcc9f5e28771934",
"attributes": {
"event": "attribute_updated",
"url": "https://www.example.com/webhook2/",
"secretToken": "$2a$10$mAPjVNOH1mavC/Hu5X1UxufoSxrTac0FqIBjTDEDeY1723Vyc.QTG",
"owner": "test@smartshape.io"
}
}
]
}
Error 4xx¶
Name | Type | Description |
---|---|---|
503 | Unauthorized |