Create a Webhook

PUT /o/wh/1/webhook

Configures a new webhook to be used for order status updates.

application/json

Body Required

  • endpointId string Required

    The unique endpoint ID, for example the integration name. Case sensitive.

  • url string Required

    The URL which this endpoint points to.

  • If basic auth should be used, defaults to false.

    Default value is false.

  • username string

    The username for basic auth.

  • password string

    The password for basic auth.

  • Whether or not to include account info in the notification.

    Default value is false.

  • Whether or not to include transaction lines in the notification.

    Default value is false.

  • Whether or not to include payment lines in the notification.

    Default value is false.

  • subscribeTo array[object]
    Hide subscribeTo attributes Show subscribeTo attributes object
    • name string

      Events to subscribe to. Order: DELIVERED can be added here.

      The following are always sent:

      • Account: CLOSED and CHECK_WAS_UPDATED.
      • Order: FAILURE, READY_FOR_PICKUP and CANCELLED.
      • Payment: SUCCESS and FAILURE.
    • resource string

      Values are order or payment.

Responses

  • 200 application/json

    Webhook

    Hide response attributes Show response attributes object
    • endpointId string Required

      The unique endpoint ID, for example the integration name. Case sensitive.

    • url string Required

      The URL which this endpoint points to.

    • If basic auth should be used, defaults to false.

      Default value is false.

    • username string

      The username for basic auth.

    • password string

      The password for basic auth.

    • Whether or not to include account info in the notification.

      Default value is false.

    • Whether or not to include transaction lines in the notification.

      Default value is false.

    • Whether or not to include payment lines in the notification.

      Default value is false.

    • subscribeTo array[object]
      Hide subscribeTo attributes Show subscribeTo attributes object
      • name string

        Events to subscribe to. Order: DELIVERED can be added here.

        The following are always sent:

        • Account: CLOSED and CHECK_WAS_UPDATED.
        • Order: FAILURE, READY_FOR_PICKUP and CANCELLED.
        • Payment: SUCCESS and FAILURE.
      • resource string

        Values are order or payment.

  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • timestamp string(date-time)

      The date and time at which the error occurred.

    • status integer

      The HTTP status code of the error response.

    • error string

      A brief title of the error status.

    • message string

      A message describing the nature of the error in detail.

    • errors array[object]

      An array of error details, outlining specific issues with the request.

      Hide errors attributes Show errors attributes object
      • codes array[string]

        A set of code strings that correspond to the validation error.

      • arguments array[object]
        Hide arguments attributes Show arguments attributes object
        • codes array[string]

          Argument codes that are related to the field in validation.

        • The default message associated with the failed validation.

        • code string

          A single code that represents the specific validation rule that was not satisfied.

      • The default error message provided when the associated field fails validation.

      • The name of the object that failed validation.

      • field string

        The name of the field that failed validation.

      • Indicates whether the error was a result of a binding failure.

      • code string

        A code representing the specific type of validation error.

    • path string

      The path of the failed request.

PUT /o/wh/1/webhook
curl \
 -X PUT https://api.lsk.lightspeed.app/o/wh/1/webhook \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"endpointId":"MY-AWESOME-ENDPOINT-ID","url":"https://webhook.site/1dc40b86-3d0d","withBasicAuth":true,"username":"username","password":"password","provideAccount":true,"expandTransactions":true,"expandPayments":true,"subscribeTo":[{"name":"DELIVERED","resource":"order"}]}'
Request examples
{
  "endpointId": "MY-AWESOME-ENDPOINT-ID",
  "url": "https://webhook.site/1dc40b86-3d0d",
  "withBasicAuth": true,
  "username": "username",
  "password": "password",
  "provideAccount": true,
  "expandTransactions": true,
  "expandPayments": true,
  "subscribeTo": [
    {
      "name": "DELIVERED",
      "resource": "order"
    }
  ]
}
Response examples (200)
{
  "endpointId": "MY-AWESOME-ENDPOINT-ID",
  "url": "https://webhook.site/1dc40b86-3d0d",
  "withBasicAuth": true,
  "username": "username",
  "password": "password",
  "provideAccount": true,
  "expandTransactions": true,
  "expandPayments": true,
  "subscribeTo": [
    {
      "name": "DELIVERED",
      "resource": "order"
    }
  ]
}
Response examples (400)
{
  "timestamp": "2023-11-07T19:15:05.043+0000",
  "status": 400,
  "error": "Bad Request",
  "message": "Validation failed for object='webhookEndpointDto'. Error count: 1",
  "errors": [
    {
      "codes": [
        "NotNull.webhookEndpointDto.endpointId",
        "NotNull.endpointId",
        "NotNull.java.lang.String",
        "NotNull"
      ],
      "arguments": [
        {
          "codes": [
            "webhookEndpointDto.endpointId",
            "endpointId"
          ],
          "defaultMessage": "endpointId",
          "code": "endpointId"
        }
      ],
      "defaultMessage": "must not be null",
      "objectName": "webhookEndpointDto",
      "field": "endpointId",
      "bindingFailure": false,
      "code": "NotNull"
    }
  ],
  "path": "/o/wh/1/webhook"
}