Update relation membership
const url = 'https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/relation-membership-update';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"relation":"example","targetElementId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","addSourceElementIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"removeSourceElementIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/relation-membership-update \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "relation": "example", "targetElementId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "addSourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "removeSourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }'Add or remove a target element from one forward relation on the named source elements, in a single commit. Backs the editable inverse relation fields, whose value lives on the sources rather than on the element being edited.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”A membership change on one forward relation, expressed from the target side. At least one of addSourceElementIds and removeSourceElementIds has to name a source, or the update is refused with the code invalid-value. A source already in the requested state is left alone, and an update that changes no source at all commits nothing.
object
The forward relation to write, named in its forward direction, the one the source elements hold, not the derived field the change was made from.
The element gaining or losing membership. May live in a dependency, subject to the relation’s own origin constraint.
Source elements that gain the target. Each must belong to this model.
Source elements that lose the target. Each must belong to this model.
Example generated
{ "relation": "example", "targetElementId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "addSourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "removeSourceElementIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}Responses
Section titled “Responses”OK
object
The source elements the update actually changed, keyed by id. A source named by the request but already in the requested state is absent, and a request that changes nothing cuts no commit.
object
object
object
object
object
object
Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.
The values the element holds that its type declares no property for; absent when none.
A value an element holds under no binding its type declares, kept so a round trip loses nothing.
object
object
object
object
Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.
A structure the import holds without an element, kept with its own properties inside the layer of the element that refers to it. A node is held once; any other place that refers to it holds a reference to it instead.
object
The property that links the holding element or the enclosing node to this node; absent on a node no property links to.
The node’s global identity in the format’s own terms; absent on an anonymous node.
A label unique within the model, set only on an anonymous node that is referred to more than once.
Whether this entry only points at the node another entry holds under the same localId.
Whether the node is an ordered list, whose entries are its members in order.
Where an element was derived from: the source and rules models, and per property the source values it read.
object
object
object
object
Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.
object
object
object
Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.
Example
{ "elements": { "additionalProperty": { "extensionLayer": [ { "kind": "attribute" } ], "lineage": { "properties": [ { "propertyType": "ATTRIBUTE", "sources": [ { "propertyType": "ATTRIBUTE", "role": "PRIMARY" } ] } ] } } }}Bad request
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}Not found
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}default
Section titled “default”Error
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}