Create batch request

POST https://app.ecwid.com/api/v3/{storeId}/batch

Request and response example

Request:

POST /api/v3/1003/batch?allowParallelMode=true HTTP/1.1
Authorization: Bearer secret_token
Host: app.ecwid.com
Content-Type: application/json
Cache-Control: no-cache

[
  {
    "id": "000001",
    "path": "/orders?limit=1&[email protected]",
    "method": "GET",
    "body": ""
  },
  {
    "id": "000002",
    "path": "/profile",
    "method": "GET",
    "body": ""
  },
  {
    "id": "000003",
    "path": "/products",
    "method": "POST",
    "body": {
      "sku": "0012199",
      "quantity": 10,
      "name": "New Product",
      "price": 19.99,
      "compareToPrice": 24.99,
      "isShippingRequired": false,
      "categoryIds": [
        9691094
      ],
      "weight": 10,
      "enabled": true,
      "description": "A <b>new</b> product description",
      "productClassId": 0
    }
  }
]

Response:

{
  "ticket": "11kl140a2-966f-1a9f-b4e6-fc451bc78570"
}

Required access scopes

Your app must have all access scopes required for requests included in the batch.

Path params

All path params are required.

Param
Type
Description

storeId

number

Ecwid store ID.

Query params

All query params are optional.

Name
Type
Description

allowParallelMode

boolean

Set true to force requests to be done in parallel. Maximum of 100 requests can be processed at the same time. If not specified, all requests in the batch will be completed consecutively.

stopOnFirstFailure

boolean

By default, batch requests stop executing on the first error response for any request included in the batch. Set false to continue executing requests even when REST API responds with error codes. Depending on the error code, batch will handle requests differently:

  • Error codes 4XX – batch executes the next request.

  • Error code 5XX – batch tries to execute the same request 5 times with a 3-second interval before moving to the next one.

deduplicationKey

string

UUID value that can be used to assign an ID to a ticket. If there's a consecutive create request with the same deduplicationKey, then the result for the first one will be retrieved. The result for this batch request is memorized for one hour.

groupId

string

Assign an internal ID to the batch request, so it can be canceled with the "Cancel batch group" request later on.

Headers

The Authorization header is required.

Header
Format
Description

Authorization

Bearer secret_ab***cd

Access token of the application.

Request JSON

A JSON array of objects (where each object is a REST API request) with the following fields:

Field
Type
Description

id

string

Internal request ID that allows you to manage requests in the batch easier. Optional

path

string

Path to Ecwid REST API endpoint. Do not include the https://app.ecwid.com/api/v3/{STORE_ID}/ part of the request URL, as is added automatically. For example: /orders?offset=100&paymentStatus=PAID,AWAITING_PAYMENT Required

method

string

HTTP method that must be used for the request.

One of: GET POST PUT DELETE Required

body

string

Request body that is required for some of the "PUT" or "POST" requests, for example, "update product" or "create customer". Optional

Response JSON

A JSON object with the following fields:

Field
Type
Description

ticket

string

Ticket ID for your batch request. Use it to get batch request status

Last updated

Was this helpful?