Поиск по сайту

API
Главная / API - Order event notifications

Order event notifications

Обновлено 25.08.2023

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo get the session ID, use the User Authorization method
idNo*integer

Subscription ID.

*The parameter is required in case of sending request to change an existing subscription

urlYesstring

Address where notifications should be sent (https scheme)

eventTypesNo*array of strings

Array of event types to send notifications about.

Event type format: "<matter>.<group of events>.<event>".

Examples:

  • "order.state.processing",
  • "order.state.declined",
  • "order.change.pickup_info"

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 

orderRolesYesarray of strings

List of user roles to send notifications to.

Available values:

  • customer,
  • sender,
  • receiver,
  • payer
stateNostring

Parameter to manage subscription status.

Available values:

  • enabled,
  • disabled

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
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

dataobjectInformation on subscription
data.idintegerSubscription ID
data.eventTypesarray of strings

List of events about which notifications will be sent (see "Event types" directory)

data.orderRolesarray of strings

List of user roles to which notifications will be sent

data.statestring

Subscription status.

Possible values:

  • enabled,
  • disabled,
  • error - stopped (notification send error)

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.urlstring

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo get the session ID, use the User Authorization method
orderNumbersYesarray 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:
  • waybill number,

  • forwarder's order number,

  • external order number

Method response

Response structure

{
   "metadata":{
      "status":200,
      "generated_at":"2023-05-25 10:49:48"
   }
}
<>

Description of parameters

Response
Response
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo get the session ID, use the User Authorization method
idsYesarray 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
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo get the session ID, use the User Authorization method
orderNumbersYesarray 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:
  • waybill number,

  • forwarder's order number,

  • external order number

Method response

Response structure

{
   "metadata":{
      "status":200,
      "generated_at":"2023-05-25 10:49:48"
   }
}
<>

Description of parameters

Response
Response
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo 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
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

dataobjectInformation on subscription
data.idintegerSubscription ID
data.eventTypesarray of strings

List of events about which notifications are sent (see "Event types" directory)

data.orderRolesarray of strings

List of user roles to which notifications are sent

data.statestring

Subscription status.

Possible values:

  • enabled,
  • disabled,
  • error - stopped (notification send error)

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.urlstring

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
ParameterRequiredTypeDescription
appkeyYesstringApplication key. To get the key, register
sessionIDYesstringTo get the session ID, use the User Authorization method
orderNumberNostring

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:
  • waybill number,

  • forwarder's order number,

  • external order number
pageNointegerPage number
perPageNointeger

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
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

metadata.currentPageintegerCurrent page number
metadata.nextPageintegerNext page number
metadata.prevPage integerPrevious page number
metadata.totalPagesintegerTotal page number
ordersarray 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:

  • the passed order number, if it is added to this subscription;
  • empty array if not added

Error handling

The common API errors are used with the method, for errors format description and errors list see Errors of API methods.