Customer Order Batch Submission

This endpoint enables the submission of a batch of customer orders data. Not all customer orders in the batch need to be associated to the same organisation TRKREF. The batch of customer orders data should be provided as a json in the request body as described below. If the batch is accepted a 202 response code will be sent back, along with an UUID that uniquely identifies this request. This functionality is enabled only for some organisations. Please contact support if you need to enable it.

Request

POST /v4/customer_orders

Parameters

Json array with the list of customer orders data being submitted, as below. Each element in the array should follow the same json model as for Single submission

[
  {...},
  {...},
  {...},
]

JSON Example

[
  {
    "trkref":"TRKREF123",
    "order_ref": "ABC123",
    "order_date": "10-12-2014",
    "fulfilment_date": "24-12-2014",
    "language": "en",
    "locale": "en-GB",
    "customer": {
      "email": "hello@example.com",
      "cutomer_ref": "1122",
      "title": "MR",
      "first_name": "John",
      "surname": "Brown",
      "postcode": "1122",
      "country": "GB"
    },
    "order_items": [
      {
        "sku": "PROD1",
        "price": "25",
        "currency": "GBP",
        "metadata": {
          "field_1": "Value 1",
          "field_2": "Value 2"
        }
      },
      {
        "sku": "PROD2",
        "price": "33",
        "currency": "GBP",
        "metadata": {
          "field_1": "Value 1",
          "field_2": "Value 2"
        }
      }
    ]
  },
  {...}
]

Response

By HTTP status:

  • 401 Unauthorized
  • You have provided wrong HTTP Basic Auth credentials
{
  "status": 401,
  "errors": "Unauthorized"
}
  • 403 Unauthorized
  • Please contact support as your API key seems to not have permission to access this API endpoint
{
  "status": 403,
  "error": "Access denied"
}
  • 422 Unprocessable Entity
{
  "status": 422,
  "id": "UUID",
  "message": "Batch is invalid",
  "summary":
    {
      "accepted": "number of accepted customer orders",
      "rejected": "number of rejected customer orders"
    },
  "errors": []
}
  • 206 Partial Content
{
  "status": 206,
  "id": "UUID",
  "message": "Batch partially accepted",
  "summary":
    {
      "accepted": "number of accepted customer orders",
      "rejected": "number of rejected customer orders"
    },
  "errors": []
}
  • 202 Accepted
{
  "status": 202,
  "id": "UUID",
  "message": "Batch Accepted",
  "summary":
    {
      "accepted": "number of accepted customer orders",
      "rejected": "number of rejected customer orders"
    }
}