Batch upsert

Edit multiple records with only one network roundtrip

You can use a batch upsert call to create or update records in the Orange Logic platform. You provide a list of records as either a JSON array or CSV file, and the API then performs a series of record updates. If a record doesn’t exist, it is created. Using these endpoints allows you to edit multiple records with only one network roundtrip.

There are three batch upsert endpoints:

ℹ️

Note

These endpoints are available beginning in Orange Logic Juneau.

Call execution

Record updates

Record updates with these APIs are done in parallel, not sequentially. If you need to make sequential updates, use multiple calls.

⚠️

Caution

Do not update the same records multiple times within a batch. Doing so could cause your updates to happen out of order, resulting in changes you did not intend.

Synchronous versus asynchronous execution

The batch upsert endpoints can run:

  • Synchronously in the Orange Logic platform.
  • Asynchronously in the background via an agent job.

When you run a call synchronously, you must wait until the server responds before continuing to use the Orange Logic platform. When you run a call asynchronously, you can use the Orange Logic platform while the call is executed. You can receive updates on the call’s status either via a separate endpoint that regularly queries the request’s status or instantaneously via webhooks.

ℹ️

Note

Asynchronous processing is off by default. To activate it, submit a support request.

Call responses

The batch upsert endpoints return the following information:

ParameterReturned Information
transactionIDIf needed, use this parameter to revert a batch request’s operations.
resultsThe array of records affected by the batch operation. Each result in the array includes:
  • recordID: Record IDs of the successfully updated or created records.
  • matchedFieldValue: The value of the identifier provided in the request. Use this value to identify which returned record corresponds to which request record.
codeThe operation’s return code for each record. Possible values:
  • SUCCESS: The record was updated or created successfully.
  • ERROR: The record was not updated or created.
  • IGNORED_EXISTING_RECORD: The record was ignored because it already exists and ignoreExistingRecords was true.
  • IGNORED_MISSING_RECORD: The record was ignored because it does not exist and ignoreMissingRecords was true.
  • MAX_RECORDS_AFFECTED: The record was ignored because the maximum number of records was reached.
errorA detailed error message. Only returned if applicable.
executeInBackgroundA boolean field that indicates whether the batch request was handled in the background (agent) or foreground (web).
  • In background mode, after receiving the request, a response is returned immediately with only executeInBackground = true and jobRecordID. Record updates can be received via webhook instantly if the webhook endpoints are specified.
  • In foreground mode, the response is returned when all operations in the batch are completed.
jobRecordIDThe asynchronous processing task recordID for the batch operation. Record updates can be received via webhook instantly if the webhook endpoints are specified.
No jobRecordID is returned for synchronous tasks.