X-RepSpark-BatchType: <BATCH_TYPE>
Each sync contains a single transaction. Batch type specifies the current step of the transaction: Begin
, Append
, and Commit
. Omitting the batch type header performs the entire sync transaction in a single request. Batch type is only applicable to POST requests, but not GET requests.
Begin
The Begin
batch type signals the start of a multi-request data transfer for the given transaction token. This step optionally accepts the first JSON data payload of the transaction.
If a Begin
request is made for a resource with an uncommitted transaction, an error is returned. The open transaction must be committed or time out before a new transaction can begin.
Append
The Append
batch type adds the incoming data to the existing data transfer for the given transaction token. This step requires a JSON data payload.
Commit
The Commit
batch type triggers the transformation and transfer of all received data to the targeted environment for the given transaction token. This step optionally accepts the last JSON data payload of the transaction.
Transactions time out and automatically close, but do not commit, after not receiving any requests in the last 30 minutes.
We recommend Begin
, Append
, and Commit
when syncing more than 1,000 records in a transaction. Otherwise, omit the batch type header and make a single API request.
Example Scenario #1
You need to sync five years of Order Reporting data that won’t fit in memory. To transfer this data, use the batch type headers. Split the data into many chunks that fit in memory, then make sequential Append
calls.
This looks like the following:
Begin
Append
(with data)
Append
(with data)
Append
(with data)
…
Commit
Example Scenario #2
You need to regularly sync a couple hundred Products for your up and coming brand. To transfer this data, omit the batch type header. Load the data from the source of truth, then make a single request to the RepSpark API with a JSON payload that contains the Products.