Webhook

V1

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 endpoints of the subscriber with an empty response template.
DELETE /v1/webhooks/{webhooktokenid} Unsubscribe from a webhook.
POST /(VendorEndPointUrl) Callback to vendors subscribed to an event.

Webhook Properties

Name Description
Event Type Type of event
  • Orders.Refund
  • Orders.BatchRefund

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
Callback a vendor with refund details.
POST  (VendorEndPointUrl)

Request

{
  "eventType": "Orders.Refund",
  "eventDateUtc": "2019-03-20T16:12:06.373Z",
  "details": {
    "OrderId": 1,
    "OrderToken": "DE267635-B3F9-4C9B-833B-225883873637",
    "RefundAmount": 5.35,
    "OrderTotal": 15.23,
    "RefundReason": "testRefundReason",
    "CreationDateUTC": "2019-03-20T16:12:06.373Z",
    "LastUpdateDateUTC": "2019-03-20T16:12:06.373Z"
  }
}

Response

HTTP/1.1 200 OK
Callback a vendor with batch refund details.
POST  (VendorEndPointUrl)

Request

{
  "eventType": "Orders.BatchRefund",
  "eventDateUtc": "2019-03-20T16:12:06.373Z",
  "details": {
    "OrderId": 1,
    "OrderToken": "DE267635-B3F9-4C9B-833B-225883873637",
    "RefundAmount": 5.35,
    "OrderTotal": 15.23,
    "RefundReason": "testRefundReason",
    "CreationDateUTC": "2019-03-20T16:12:06.373Z",
    "LastUpdateDateUTC": "2019-03-20T16:12:06.373Z"
  }
}

Response

HTTP/1.1 200 OK