added
API - Added ability to edit Webhook configuration
November 10th, 2021
🚀 Feature Release
Locations included in a webhook can now be updated using the API. This new endpoint requires the access scope write:device
.
The endpoint is created using the PATCH
method, applying the concept from this RFC allowing the user to perform multiple operations on a resource.
The endpoint at this stage only takes the locations
path.
Note that we do not allow adding an empty location to the webhook, therefore, a device must be added to a location before it can be added to the webhook.
To edit locations on a webhook, use the following endpoint with the example request body:
PATCH /webhooks/{webhookId}?organizationId={organizationId}
{
"operations": [
// Add location to a webhook
{
"op": "ADD",
"path": "locations",
"value": [
"69cbabbf-74a3-47c9-8c23-0ec8b59e886b",
"1ddc4b5a-ca8c-4ac3-93a4-e7c6d418549c",
"0f6f41fb-42a1-4aaa-8337-fb642176e136",
"8e40dff9-98c3-4bf4-9aa8-dfe76c2652c6"
]
},
// Remove certain locations from a webhook
{
"op": "REMOVE",
"path": "locations",
"value": [
"337d2956-8ba4-45c1-9ae1-50a2a1a46f69",
"580c4513-20e4-4d4e-b842-79aa5c053442"
]
},
// Remove all locations from a webhook
{
"op": "REMOVE",
"path": "locations"
}
]
}