Order event notifications
General information
The service allows managing subscriptions for notifications about events occurring with orders (the list of available events is contained in "Event types" directory).
It's possible to create up to 10 subscriptions. You can add the required set of orders to each subscription and configure for it a list of events that trigger notifications, as well as a list of user roles to which notifications should be sent.
The service is available to authorized users only.
Subscription creating/changing
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/update
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000", "id": "2", "url": "https://webhook.site", "eventTypes": [ "order.state.pickup" ], "orderRoles": [ "sender" ], "state": "enabled" }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
id | No* | integer | Subscription ID. *The parameter is required in case of sending request to change an existing subscription |
url | Yes | string | Address where notifications should be sent (https scheme) |
eventTypes | No* | array of strings | Array of event types to send notifications about. Event type format: "<matter>.<group of events>.<event>". Examples:
List of available types (combinations of matter, group and event) with their description see in "Event types" directory. *If the parameter is not passed, then the subscription will be created for all event types |
orderRoles | Yes | array of strings | List of user roles to send notifications to. Available values:
|
state | No | string | Parameter to manage subscription status. Available values:
Default value: "enabled" |
Method response
Response structure
{ "metadata": { "status": 200, "generated_at": "2023-06-02 14:13:40" }, "data": { "id": 2, "eventTypes": [ "order.state.pickup" ], "orderRoles": [ "sender" ], "state": "enabled", "url": "https://webhook.site" } }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
data | object | Information on subscription |
data.id | integer | Subscription ID |
data.eventTypes | array of strings | List of events about which notifications will be sent (see "Event types" directory) |
data.orderRoles | array of strings | List of user roles to which notifications will be sent |
data.state | string | Subscription status. Possible values:
The "error" status is set for the subscription if a notification delivery error occurred on the receiver's side. In this case, an attempt will be made to re-deliver this notification after 1 minute, 20 minutes and 3 hours.If 4 attempts to deliver notifications (in a row) within the same subscription are unsuccessful, then this subscription is automatically disabled |
data.url | string | Address to which notifications will be sent |
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.
Adding orders to a subscription
The service allows adding orders to a subscription.
Substitute the subscription ID for {id} in the method address.
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/{id}/orders/add
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000", "orderNumbers":[ "8216702228554", "8217711111041" ] }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
orderNumbers | Yes | array of strings | Array of order numbers to add to the subscription. The maximum number of order numbers in the array is 5. The order number for one of the following parameters can be obtained using the "Order list" method:
|
Method response
Response structure
{ "metadata":{ "status":200, "generated_at":"2023-05-25 10:49:48" } }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.
Deleting subscriptions
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/delete
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000", "ids":[ 1, 2 ] }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
ids | Yes | array of integers | Array of IDs of subscriptions to remove |
Method response
Response structure
{ "metadata":{ "status":200, "generated_at":"2023-05-25 10:49:48" } }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.
Removing orders from a subscription
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/{id}/orders/delete
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000", "orderNumbers":[ "8216702228554", "8217711111041" ] }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
orderNumbers | Yes | array of strings | Array of order numbers to remove from the subscription. The maximum number of order numbers in the array is 5. The order number for one of the following parameters can be obtained using the "Order list" method:
|
Method response
Response structure
{ "metadata":{ "status":200, "generated_at":"2023-05-25 10:49:48" } }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.
Subscription Information
The service allows receiving information about subscriptions.
To get information about a specific subscription, replace {id} with the subscription ID in the method address.
To get information about all subscriptions, an address without a subscription ID is used.
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/{id} or https://api.dellin.ru/v1/webhooks
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000" }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
Method response
Response structure
{ "metadata": { "status": 200, "generated_at": "2023-05-25 11:09:32" }, "data": [ { "id": 3, "eventTypes": [ "order.state.completed" ], "orderRoles": [ "customer", "payer", "receiver", "sender" ], "state": "enabled", "url": "https://webhook.site" } ] }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
data | object | Information on subscription |
data.id | integer | Subscription ID |
data.eventTypes | array of strings | List of events about which notifications are sent (see "Event types" directory) |
data.orderRoles | array of strings | List of user roles to which notifications are sent |
data.state | string | Subscription status. Possible values:
The "error" status is set for the subscription if a notification delivery error occurred on the receiver's side. In this case, an attempt will be made to re-deliver this notification after 1 minute, 20 minutes and 3 hours.If 4 attempts to deliver notifications (in a row) within the same subscription are unsuccessful, then this subscription is automatically disabled |
data.url | string | Address to which notifications are sent |
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.
List of orders from a subscription
The service allows getting a list of the order numbers added to subscription with a specific ID or find out if an order with a specific number has been added to it.
Method request
Request structure
Method address: https://api.dellin.ru/v1/webhooks/{id}/orders
{ "appkey":"00000000-0000-0000-0000-000000000000", "sessionID":"00000000-0000-0000-0000-000000000000", "orderNumber":"8216702228554", "page":2, "perPage":10 }
<>
Description of parameters
Request
Request | |||
---|---|---|---|
Parameter | Required | Type | Description |
appkey | Yes | string | Application key. To get the key, register |
sessionID | Yes | string | To get the session ID, use the User Authorization method |
orderNumber | No | string | Order number. Used to check if an order with a specific number has been added to a subscription. If this parameter is passed, information about other orders will not be displayed in the response. If the parameter is not passed, then the response contains an array of order numbers added to this subscription. The order number for one of the following parameters can be obtained using the "Order list" method:
|
page | No | integer | Page number |
perPage | No | integer | The number of elements per page. Minimum value: 1, Maximum value: 100, Default value: 100 |
Method response
Response structure
{ "metadata": { "status": 200, "generated_at": "2023-05-25 11:09:32", "currentPage": 2, "nextPage": 3, "prevPage": 1, "totalPages": 30 }, "orders": [ "8216702228554", "8217711111041" ] }
<>
Description of parameters
Response
Response | ||
---|---|---|
Parameter | Type | Description |
metadata | object | System information |
metadata.status | integer | Emulated status http-code. If successful, code 200 is returned |
metadata.generated_at | string | Server response date and time. Format: YYYY-MM-DD HH:MM:SS |
metadata.currentPage | integer | Current page number |
metadata.nextPage | integer | Next page number |
metadata.prevPage | integer | Previous page number |
metadata.totalPages | integer | Total page number |
orders | array of strings | If the order number was not passed in the "orderNumber" parameter of the request, then this parameter contains an array of order numbers added to this subscription. If the order number was passed, then this parameter contains:
|
Error handling
The common API errors are used with the method, for errors format description and errors list see Errors of API methods.