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:
The target_url - to which we will send the data when the event occurs
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
Unsubscribe
Last updated