Skip to content

Retrieve a twin

Request

Security
oauth2
Path
idstringrequired

Id of the twin

Query
includeRelationshipsboolean

When true, the response includes the incoming and outgoing relationships

Default:false
GET
/twins/{id}
const query = new URLSearchParams({
  includeRelationships: 'false'
}).toString();

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

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

Responses

Twin information successfully retrieved.

Bodyapplication/json
idstring, non-emptyrequired

The unique Id of the digital twin.

Example:"TW-DD-II-L01"
modelIdstring, non-emptyrequired

Digital Twin Model Identifier.

Example:"dtmi:com:willowinc:Level;1"
lastUpdateTimenull or string, (date-time)

Timestamp when the twin was last updated in ISO 8601 format.

Example:"2024-08-30T03:49:30.4062816+00:00"
eTagnull or string

Concurrency tag for optimistic concurrency control. Populated from the underlying ADT entity when sourced from AdtQuery; null when sourced from ADX.

contentsobject

This field will contain properties and components as defined in the contents section of the DTDL definition of the twin.

Example:
{ "levelNumber": 0, "mappedIds": [ {}, {}, {}, {}, {}, {} ], "name": "Floor_1", "uniqueID": "a360cf30-c112-40a1-b4b4-f65da82fa9e8", "externalID": "FLRPXxxxxxxxxxxxxxxxx", "code": "L01", "siteID": "104bd33c-a697-4027-b6a6-677e30a53d09", "alternateClassification": { "brickSchema": {} }, "externalIds": { "mappingKey": "msrc:///CON5xxxxxxxxxxxxxxxx@willow-source/twin/TW-DD-II-L01" }, "area": { "$metadata": {} } }
incomingRelationshipsArray of objects(DigitalTwinRelationship)

Incoming relationships

Example:
[ { "Id": "Room-L01-100_isPartOf_TW-DD-II-L01", "targetId": "TW-DD-II-L01", "sourceId": "Room-L01-100", "name": "isPartOf" } ]
outgoingRelationshipsArray of objects(DigitalTwinRelationship)

Outgoing relationships

Example:
[ { "Id": "TW-DD-II-L01_isPartOf_BLDG-1", "targetId": "BLDG-1", "sourceId": "TW-DD-II-L01", "name": "isPartOf" } ]
Response
{ "id": "TW-DD-II-L01", "modelId": "dtmi:com:willowinc:Level;1", "lastUpdateTime": "2024-08-30T03:49:30.4062816+00:00", "contents": { "levelNumber": 0, "mappedIds": [], "name": "Floor_1", "uniqueID": "a360cf30-c112-40a1-b4b4-f65da82fa9e8", "externalID": "FLRPXxxxxxxxxxxxxxxxx", "code": "L01", "siteID": "104bd33c-a697-4027-b6a6-677e30a53d09", "alternateClassification": {}, "externalIds": {}, "area": {} }, "incomingRelationships": [ {} ], "outgoingRelationships": [ {} ] }