Add a new Webhook

POST /api/v2/webhooks.json

Subscribe to one or more events within an Account in a single webhook endpoint.

Scope

Requires the default scope only.

Request body

Your request body must contain an object including:

data required
Containing a Webhook object.


Example JSON request

To add a Webhook you must POST a Webhook Object to this resource within a dataobject. The minimum requirements for a webhook is an array of events you wish to subscribe to and the destination url which receives POST requests from Evance.

{
    "data": {
        "events": [
            "product/*",
        ],
        "url": "https://www.example.com/webhook-consumer"
    }
}


Success responses

If the Webhook was created successfully you should receive a response with a 201 status code:

success
A boolean where a value of true means the Webhook was created successfully.
status
The HTTP status code e.g. 201 means the Webhook was created successfully.
data
Contains the Webhook object you created including its new id.


Error responses

If the Webhook could not be created you will encounter a response with a 422 status code:

success
A boolean where a value of false means the Webhook could not be created.
status
A response code of 422 means the Webhook could not be created and you should check the errors property for further information.
context
The context property indicates where the error occurred. For a 422 error this will typically contain a value of data, indicating that there was an error with the data object supplied.
errors

Contains an array of error objects, each will have the following properties:

  • name - The property name that encountered an error.
  • message - A human readable error message.
  • ref - An error reference string (e.g. error.uri-scheme-invalid if the URL supplied is not HTTPS).