Batch Ids

A Batch Id (batchId) is an optional user provided string that can be associated with a component or reference being created. The batch Id serves the following purposes:

  1. Allow for a component being created to be referenced within the same request.

    1. A component may use the batchId of another component in the request as the value for the parent field.
    2. A reference may use the batchId of a component in the request as the value for the source field.
    3. A reference may use the batchId of a component in the request as the value for the target field.
  2. In the response every provided batch Id will be associated with a generated OID. As the response of a batch does not guarantee any ordering, the batchId can be stored on the client side and then used to find the associated created component/reference in the response.

{
  "components": {
    "create": [
      {
        "batchId": "C1",
        "body": {
          "rootWorkspace": "c253c98231776d0c8a54879e",
          "typeId": "p1024822409134",
          "name": "C1"
        }
      }
    ],
    "upsert": [
      {
        "batchId": "C2",
        "uniqueBy": ["rootWorkspace", "name"],
        "body": {
          "rootWorkspace": "c253c98231776d0c8a54879e",
          "typeId": "p1024822409134",
          "name": "C2"
        }
      }
    ]
  },
  "references": {
    "create": [
      {
        "batchId": "R1",
        "body": {
          "source": "C1",
          "target": "C2",
          "type": 2
        }
      }
    ]
  }
}