REST Hooks

REST Hooks are a way to implement Webhooks. The REST hooks are used to subscribe for a certain event through our API and receive back the information you have subscribed for.

Currently we provide 4 events to which you can subscribe and receive information when something has occurred.

Subscription name

Description

New_Order

When a new order is created in Vendisto, the order and order line data is sent to the subscriber.

New_Product

When a new product is created in Vendisto, the product data is sent to the subscriber.

New_NewsItem

When a new news item is created in Vendisto, the news item data is sent to the subscriber.

New_Customer

When a new customer is created in Vendisto, the customer data is sent to the subscriber.

Deleted_Product

When a product is deleted in Vendisto, the product id, number and status will be sent to the subscriber.

Suspended_Product

When a product is suspended is Vendisto, the product id, number and status will be sent to the subscriber.

The New_Product event is not for products created through the Vendisto UI, but for the new ones imported using the Simplified Article Import!

Use the subscription name as an event_type name!

How to use REST Hooks?

In order to use the REST hooks you first must create generate a token using our Application management section in the Settings of Vendisto. This way you can use the token to authenticate when making requests to the Vendisto API.

Then, there are two possible scenarios when using the REST hooks. You can either subscribe or unsubscribe to an event.

Subscribe

Endpoint url: [POST] api-{shopUrl}/webhooks/subscribe - for more info refer to the webhooks section of the swagger documentation of the API at api-{shopUrl}/swagger.

You must provide two fields in the request body:

  1. The target_url - to which we will send the data when the event occurs

  2. The event_type: New_Order, New_Customer, New_NewsItem, New_Product

The response of this request will contain the subscription id, event_type and target_url. You should store this subscription id because you will need it in order to unsubscribe from the event.

Unsubscribe

Endpoint url: [DELETE] api-{shopUrl}/webhooks/unsubscribe/{subscriptionId} - for more info refer to the webhooks section of the swagger documentation of the API at api-{shopUrl}/swagger.

You must provide the subscription id as a url parameter.

To both requests you should add either Authorization or x-api-key header with value - Bearer {token}!

Be aware to set the body of the subscribe request as Json and not as Text. In the screenshot below you can see how JSON is selected on top right.

Example of subscribe and unsubscribe requests

Subscribe

Event fired response

"orderWithOrderLines": {
      "OrderLines": [
        {
          "OrderLineId": "b8b549f5-39c7-418f-9167-66fe1ab93044",
          "OrderId": "b1baa92f-e1cc-4ac4-8a1f-6d8cafbb2b55",
          "Position": 1,
          "ArticleId": "bf095e2b-8658-4404-8b5c-12bbb69b340b",
          "ArticleNumber": "656516512651",
          "Name": "10,8 V CC300 Glas- en tegelsnijder - Accu-Glas-/tegelsnijder 10,8V CC300DWE - 2x1,3Ah",
          "Quantity": 3,
          "PriceWithoutTax": 9.91,
          "Tax": 2.08,
          "TaxPercentage": 21,
          "TotalPriceWithoutTax": 29.73,
          "IsTaxIncludedInPrice": true,
          "StockStatus": "NotApplicable",
          "Type": "Product"
        },
        {
          "OrderLineId": "12ceab82-c20a-43ac-9505-4cbcfb174f3e",
          "OrderId": "b1baa92f-e1cc-4ac4-8a1f-6d8cafbb2b55",
          "Position": 2,
          "ArticleId": "a9ea68bd-d62d-4406-939c-12c69994fa7c",
          "ArticleNumber": "08101043",
          "Name": "10,8 V Accu - Accu 10,8V Li-ion 1,3Ah BL1013",
          "Quantity": 1,
          "PriceWithoutTax": 20.66,
          "Tax": 0,
          "TotalPriceWithoutTax": 20.66,
          "IsTaxIncludedInPrice": false,
          "StockStatus": "NotApplicable",
          "Type": "Product"
        }
      ],
      "OrderId": "b1baa92f-e1cc-4ac4-8a1f-6d8cafbb2b55",
      "OrderNumber": "000508",
      "DeliveryMethod": "Delivery",
      "PaymentMethod": "Ideal",
      "Gender": "Undefined",
      "FirstName": "Aleksandar",
      "MiddleName": "Georgiev",
      "LastName": "Georgiev",
      "StreetAddress1": "Wattstraat 17",
      "PostalCode": "5621AG",
      "City": "Eindhoven",
      "Country": "The Netherlands",
      "UseSeparateDeliveryAddress": false,
      "DeliveryFirstName": "Aleksandar",
      "DeliveryMiddleName": "Georgiev",
      "DeliveryLastName": "Georgiev",
      "DeliveryStreetAddress1": "Wattstraat 17",
      "DeliveryPostalCode": "5621AG",
      "DeliveryCity": "Eindhoven",
      "DeliveryCountry": "The Netherlands",
      "PhoneNumber": "0657444295",
      "MobilePhoneNumber": "0657444295",
      "EmailAddress": "test@gmail.com",
      "Created": "2021-01-07T14:56:19.163Z",
      "TotalPriceWithoutTax": 50.39,
      "TotalPrice": 56.63,
      "TotalTax": 6.24,
      "TotalPayed": 0,
      "TotalAmountOwed": 56.63,
      "TotalAmount": 56.63,
      "PaymentStatus": "Open",
      "InvoiceStatus": "None",
      "OrderDeliveryMode": "Stock",
      "OrderStatus": "Created",
      "CanBeUpdated": true,
      "CanBeConfirmed": true,
      "CanBePaid": true,
      "CanBeApproved": false,
      "CanBeProcessed": false
  }
  

Unsubscribe

Last updated