Skip to content

List outgoing relationships for a twin

Request

Security
oauth2
Path
twinIdstringrequired

Id of the source twin

Query
relationshipNamenull or string

Name of the relationship to filter the list. This parameter is optional and sending null will return all the outgoing relationships.

const query = new URLSearchParams({
  relationshipName: '{relationshipName}'
}).toString();

const twinId = 'YOUR_twinId_PARAMETER';
const instance = 'YOUR_instance_PARAMETER';
const resp = await fetch(
  `https://${instance}.app.willowinc.com/api/v3/twins/${twinId}/relationships/outgoing?${query}`,
  {
    method: 'GET',
    headers: {
      Authorization: 'Bearer <YOUR_TOKEN_HERE>'
    }
  }
);

const data = await resp.text();
console.log(data);

Responses

Target relationships retrieved.

Bodyapplication/json
Array [
idstring

The unique Id of the relationship entity.

targetIdstring, non-emptyrequired

The Id of the target twin.

Example:"Chiller-1"
sourceIdstring, non-emptyrequired

The Id of the source twin.

Example:"AHU-1"
namestring, non-emptyrequired

The name of the relationship, which defines the type of link from source twin to target twin (e.g. isPartOf, locatedIn, servedBy, etc.. ).

Example:"isFedBy"
propertiesobject

Additional properties of the relationship as defined in the DTDL model.

Example:
{ "substance": "ChilledWater" }
]
Response
[ { "Id": "AHU-1_isFedBy_substance_ChilledWater_Chiller-1", "targetId": "Chiller-1", "sourceId": "AHU-1", "name": "isFedBy", "properties": { … } } ]