Open Inventory / Docs
EndpunkteInventory structureResourcesIdRelations

Create or pin a manual relationship

Die API läuft auf deiner Anwendungsinstanz. Schemas und Feldnamen stammen unverändert aus der OpenAPI-Spezifikation. Browsergebundene Aufrufe benötigen eine Sitzung auf der Instanz.

POST
/resources/{id}/relations

One endpoint must match the resource id in the path. Containment relationships reject invalid parents, self-reference, and direct or indirect cycles. Creating an existing spatial relationship converts it to a manual relationship.

Authentifizierung

bearerAuth
headerAuthentifizierungBearer <inv_ token>

Pfadparameter

id*string
Formatuuid

Header-Parameter

X-Organization-ID?string

Organization membership selected for this request. User-bound credentials may select any active membership; standalone tokens may only repeat their pinned organization ID.

Formatuuid

Anfrageinhalt

application/json
  1. body
sourceResourceId*string

Directed parent or subject endpoint.

Formatuuid
targetResourceId*string

Directed child or object endpoint.

Formatuuid
relationTypeKey*string

Stable key of an administrator-configurable directed relationship type.

Muster^[a-z][a-z0-9_-]{0,63}$
Länge1 <= length <= 64

Antwortinhalt

Manual relationship created or pinned

application/json
  1. response
relation*
Beispielanfrage
curl -X POST 'https://inventory.example.com/api/v1/resources/497f6eca-6276-4993-bfeb-53cbbbba6f08/relations' \  -H 'Content-Type: application/json' \  -d '{  "sourceResourceId": "481dd929-1ef7-4b4f-8c71-b35f932f1b65",  "targetResourceId": "8b52d9f4-692a-4d1f-8c9f-c36bd283d92e",  "relationTypeKey": "string"}'
Beispielantwort
{  "relation": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "sourceResourceId": "481dd929-1ef7-4b4f-8c71-b35f932f1b65",    "targetResourceId": "8b52d9f4-692a-4d1f-8c9f-c36bd283d92e",    "relationTypeKey": "string",    "origin": "manual",    "sourceFeatureId": "string",    "targetFeatureId": "string",    "attributes": {},    "createdBy": "string",    "createdAt": "2019-08-24T14:15:22Z"  }}