The Webhook JSON object defines inventory data for an item of the  Dsco system.

Please read the Webhook Overview to understand how the Webhook system works.

- Make sure you're familiar with JSON before continuing.
- The JSON objects are defined using Orderly.  Optional attrs end with a "?" all others are required.

- isodate fields use one of these ISO 8601 format: 2014-01-01T10:30:00.000+01:00, 2014-01-01T10:30:00.000+0100, 2014-01-01T10:30:00.000Z
- Dsco reserves the right to add new attributes at any time so Partners should ensure their validators won't break should this happen

Definition

Object
{
    string webhookUuid?;             # Unique ID for webhook, generated by Dsco when webhook is created
    int owningAccountId?;            # The ID of the account owning the webhook (should be your account ID); you can leave this blank
                                     # and Dsco will fill it in for you.
    int webhookAccountId;            # The ID of the account whose data you want events to fire for (your own or a partner's)
    string description?;
    string event[ORDER_CREATED,      # The event will only trigger a callback to you if the data change event is this type (specify
                 ORDER_UPDATED,      # multiple webhooks to listen for multiple event types)
                 INVENTORY_UPDATED,
                 INVOICE_CREATED,
                 INVOICE_UPDATED,
                 ORDER_LINE_ITEM_STATUS_UPDATED];
    string callbackUrl;              # The fully qualified URL Dsco will call when the event criteria are met
    boolean enabled;                 # Dsco will ignore webhooks that are not enabled

    boolean applyToPartners?;        # If true, DSCO will trigger this event for all partners of the webhookAccountID (which must be your own account);
                                     # Note that this is only valid when the event type is INVENTORY_UPDATED and that it may only be set if your account
                                     # type is "Retailer" and that catalogIds and assortmentIds can not be set when this is set to true.

    boolean quantityStateChangeOnly?; # If true and this event type is INVENTORY_UPDATED, then this webhook will only be fired when the quantity 
                                      # changes from less than 1 to more than 1 or from greater than 0 to less than 1 or when the inventory is seen
                                      # for the first time; this attribute and quantityChangeOnly may not both be true  

    boolean quantityChangeOnly?;      # If true and this event type is INVENTORY_UPDATED, then this webhook will only be fired when the quantity 
                                      # changes or when the inventory is seen for the first time;
                                      # this attribute and quantityStateChangeOnly may not both be true

    array {string} catalogIds?;      # The event will only trigger if the changed data is in one of these catalogs
                                     # Only catalogIds or assortmentIds may be specified but not both -
                                     # this only applies if the event type is INVENTORY_UPDATED
    array {string} assortmentIds?;   # The event will only trigger if the changed data is in one of these assortments
                                     # Only catalogIds or assortmentIds may be specified but not both -
                                     # this only applies if the event type is INVENTORY_UPDATED
    array {ref HttpHeader} customHttpHeaders?; # A list of http headers to include on webhook callbacks                                     
    isodate createDate?;             # Date created
    isodate lastUpdate?;             # Date last updated
};

Example

{
    "webhookUuid": "b5599fc5-053e-46ef-8f98-1e979bd1b5fe",
    "owningAccountId": 12311,
    "webhookAccountId": 92171,
    "description": "Notify me when orders are created for my trading partner",
    "event": "ORDER_CREATED",
    "callbackUrl": "https://my.callback.url?type=ordercreated",
    "enabled": true,
    "applyToPartners": false,
    "quantityStateChangeOnly": false,
    "createDate": "2014-01-01T10:30:00+00:00",
    "lastUpdate": "2014-01-01T10:30:00+00:00"
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.