Webhook

V1

This representation is not yet finalized and is subject to change.

The webhook allows a vendor to get a callback on the endpoint provided after the event he is subscribed to is executed.


Endpoints

Verb Endpoint Description
GET /v1/webhook-events Get available events to subcribe to.
POST /v1/webhooks Subscribe to a webhook event
GET /v1/webhooks Get all the events, the vendor has subscribed to.
POST /v1/webhooks/{webhooktokenid}/test Test if a webhook has been successfuly subscribed. Calling this endpoint will callback all the enpoints of the subscriber with an empty response template.
DELETE /v1/webhooks/{webhooktokenid} Unsubscribe from a webhook.

Examples

Get available events to subcribe to.
GET  /v1/webhook-events

Response

{
  "events": [
    {
      "type": "Orders.Refund",
      "description": "Refund for orders"
    },
    {
      "type": "Orders.BatchRefund",
      "description": "Batch refund for orders"
    }
  ]
}
Subscribe to the webhook event listed in the request.
POST  /v1/webhooks

Request

{
  "eventType": "Orders.Refund",
  "href": "https://www.vendorUrl.com/amc-webhooks/order-refunds"
}

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v1/webhooks/token-8ada0d8e-25ff-4a35-aa82-1ff11098745a
Get all the events, the vendor has subscribed to.
GET  /v1/webhooks

Response

{
  "count": 2,
  "_embedded": {
    "events": [
      {
        "token": "8700e411-a814-475b-ba51-8e4c0b1f6719",
        "eventType": "Orders.Refund",
        "href": "https://www.vendorUrl.com/amc-webhooks/order-refunds",
        "_links": {
          "self": {
            "href": "http://amctheatres.com/v1/webhooks/8700e411-a814-475b-ba51-8e4c0b1f6719",
            "templated": false
          }
        }
      },
      {
        "token": "cf855cba-0bf8-4808-b422-83205be7e20c",
        "eventType": "Orders.BatchRefund",
        "href": "http://www.VendorUrl/v1/order-batch-refunds",
        "_links": {
          "self": {
            "href": "http://amctheatres.com/v1/webhooks/cf855cba-0bf8-4808-b422-83205be7e20c",
            "templated": false
          }
        }
      }
    ]
  }
}
Test if a webhook has been successfuly subscribed.
POST  /v1/webhooks/{webhooktokenid}/test

Response

HTTP/1.1 200 OK
Unsubscribe from a webhook.
DELETE  /v1/webhooks/{webhooktokenid}

Response

HTTP/1.1 200 OK