Table of Contents
Last updated: 2024-06-26

Multi SoftType create


The "Multi SoftType create" API allows for the creation of multiple SoftType instances of multiple SoftTypes within one change set. This also allows for references between these instances to be created within that change set.

This should not be confused with the batch API. With the batch API it is possible to create multiple instances within one change set (multiple POSTs), though the batch API will not allow you to create reference between the instances created in different POST operations within the batch.

Note

The multi SoftType create POST operations can be used within a batch.

Caution

The number of instances that can be created with the multi SoftType create is limited to a maximum of 50 instances within one POST. If there is a need for the creation of more than 50 instances, use the SoftType importer instead.

API route


The SoftType root is used for handling the multi SoftType create POST.

HTTP POST https://{fqdn}/space/{spaceId}/softtype

The payload is an array of SoftType instances, wrapped with a temporary instance id (for referencing between instances), a type definition, followed by the actual data payload for the instance.

[
  {
    "$id": "1",
    "$softType": "MySoftType",
    "data": {
      ...
    }
  },
  {
    "$id": "2",
    "$softType": "MySoftType",
    "data": {
      ...
    }
  },
  {
    "$id": "3",
    "$softType": "MyOtherSoftType",
    "data": {
      ...
    }
  },
  ...
]

Payload example


In this example we are instantiating two instances of the SoftType DesignPart and also creating a structural reference between them. Part-2 is the parent of Part-1.

[
  {
    "$id": "1",
    "$softType": "DesignPart",
    "data": {
      "id": "Part-1",
      "name": "Name-1",
      "versionId": "v1"
    }
  },
  {
    "$id": "2",
    "$softType": "DesignPart",
    "data": {
         "id": "Part-2",
         "name": "Name-2",
      "versionId": "v1",
      "consistsOf": {
        "id": "001",
        "value": {
          "instanceRef": "1",
          "softTypeId": "DesignPart"
        }
      }
    }
  }
]

Note that consistsOf.value of Part-2 is using an instanceRef to refer to the instance id ($id) of the instance for Part-1.