Reference data

Batch upsert table draft records

Create new records in the draft dataset, or update existing draft records, in a single batch operation.

Items with a urn update the existing record, items without one create a new record. When you update an existing record, only the attributes you send are updated; all other attributes remain unchanged. Address each record with at most one item: a record URN repeated in a later item fails that item with VALIDATION_ERROR. Changes stay in the draft until they are published with the Publish draft changes operation.

Each item carries a caller-supplied id, unique within the batch, which is echoed back in the corresponding result. Results are returned in the order of the request items. Save the URNs of newly created records from results[].data if you need to update or delete them later.

Atomic: either every item succeeds or nothing is written. On success, every result has status OK. On failure, each failing item reports its own error: RESOURCE_NOT_FOUND when its record URN does not exist in the draft, or VALIDATION_ERROR when its values or its record URN are invalid. Every other item reports NOT_PROCESSED. A failed batch still returns 207: check meta.fail (or each results[].status), not only the HTTP status. All failures found while validating the batch are reported together, so you can fix every failing item before retrying. An unexpected failure while writing returns 500, and nothing is written. Retry the whole batch after fixing the failing items; nothing from a failed batch is kept.

Errors that concern the request as a whole are not reported per item: a body that violates the schema (for example a missing or empty id, or a urn that is not a record URN), an empty batch, more than 100 items, or duplicate id values return 400, and a missing table or draft returns 404.

post/reference-data/v1/tables/{tableUrn}/draft/batch/upsert

Request

Path parameters

tableUrnstring uri required

A URN identifying a table resource in the Reference Data API.

Format: urn:ata:{tenant}:reference-data:table:{uuid}

Example: urn:ata:acme-corp:reference-data:table:123e4567-e89b-12d3-a456-426614174000.

Example:urn:ata:acme-corp:reference-data:table:123e4567-e89b-12d3-a456-426614174000

Table URN identifier.

Request body

Example request

{
  "data": [
    {
      "id": "row-1",
      "urn": "urn:ata:acme-corp:reference-data:record:523e4567-e89b-12d3-a456-426614174004",
      "values": [
        {
          "recordUrn": "urn:ata:acme-corp:reference-data:record:523e4567-e89b-12d3-a456-426614174004"
        }
      ]
    }
  ]
}

Response

Multi-status batch outcome. Because the batch is atomic, either every item in results is OK (with data), or none is: failing items carry their own error and all others are NOT_PROCESSED. meta.success therefore equals meta.total on success and 0 on failure.

Example response

{
  "meta": {
    "total": 2,
    "success": 2
  },
  "results": [
    {
      "id": "row-1",
      "status": "OK",
      "data": {
        "urn": "urn:ata:acme-corp:reference-data:record:523e4567-e89b-12d3-a456-426614174004",
        "values": [
          {
            "recordUrn": "urn:ata:acme-corp:reference-data:record:523e4567-e89b-12d3-a456-426614174004"
          }
        ],
        "lastChangedByUrn": "urn:ata:acme-corp:iam:user:jane.doe@acme-corp.com",
        "state": "NEW"
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.