Create a webhook subscription.
If the doshii-location-id is supplied in the headers, the webhook will be registered against the supplied location, which will effectively ensure only events for that location will be sent to that webhook. If no location is specified then the webhook will be considered a global webhook, meaning any event from any subscribed location will be sent to that webhook endpoint. Only one global webhook may be registered for a given Doshii event.
POST ~/webhooks
Headers
Field | Type | Description |
---|---|---|
doshii-location-idoptional | String |
The hashed ID of the location you're targeting. See Hashed Location IDs. This header is optional and if not supplied, the webhook will be registered against all subscribed locations. |
Parameters
Field | Type | Description |
---|---|---|
event | String |
The name of the Doshii event that the webhook subscription is being created for. |
webhookUrl | URL |
A valid URL, hosted external to Doshii, that is capable of receiving POST requests with the Doshii events. See Webhook Verification for more details. |
authenticationKeyoptional | String |
The key used in the webhook authentication. See Webhook Authentication for more details. |
authenticationTokenoptional | String |
The token used in the webhook authentication. See Webhook Authentication for more details. |
Response
Field | Type | Description |
---|---|---|
event | String |
The Doshii event that this webhook is subscribed to |
webhookUrl | String |
A valid URL, hosted external to Doshii, that is capable of receiving POST requests with the Doshii events |
authenticationEnabled | boolean |
Indicates whether or not authentication credentials have been associated to the webhook |
webhookLatency | Number |
Specifies the time in milliseconds it took for your webhook to respond to the verification process. See Webhook Verification for more details. |
updatedAt | String |
Date when the webhook was last updated |
createdAt | String |
Date when the webhook was created |
uri | String |
The object details url |
Examples
Request: Create a webhook subscription
{
"event": "order_created",
"webhookUrl": "https://some.external.site/doshii/webhook",
"authenticationKey": "secure_key",
"authenticationToken": "secure_token"
}
Response
{
"event": "order_created",
"webhookUrl": "https://some.external.site/doshii/webhook",
"authenticationEnabled": true,
"webhookLatency": 5000,
"uri": "http://sandbox.doshii.co/partner/v3/webhooks/order_created",
"updatedAt": "2018-07-17T07:52:28.122Z",
"createdAt": "2018-07-17T07:52:28.122Z"
}
Comments
1 comment
Hi Ben, yes, thanks for picking that up. I have amended the docs.
Please sign in to leave a comment.