Twins - DigitalTwins ListRelationships
Retrieves the relationships from a digital twin. Status codes:
- 200 OK
- 400 Bad Request
- InvalidArgument - The digital twin id is invalid.
- 404 Not Found
- DigitalTwinNotFound - The digital twin was not found.
GET https://digitaltwins-hostname/digitaltwins/{id}/relationships?api-version=2023-10-31
GET https://digitaltwins-hostname/digitaltwins/{id}/relationships?relationshipName={relationshipName}&api-version=2023-10-31
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
id
|
path | True |
string |
The id of the digital twin. The id is unique within the service and case sensitive. |
api-version
|
query | True |
string |
The requested API version. |
relationship
|
query |
string |
The name of the relationship. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
traceparent |
string |
Identifies the request in a distributed tracing system. |
|
tracestate |
string |
Provides vendor-specific trace identification information and is a companion to traceparent. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Success |
|
Other Status Codes |
Default response. Headers x-ms-error-code: string |
Security
oauth2
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize?resource=0b07f429-9f4b-4714-9392-cc5e8e80c8b0
Examples
List relationships |
List relationships by name |
List relationships
Sample request
GET https://digitaltwins-hostname/digitaltwins/mySourceTwin/relationships?api-version=2023-10-31
Sample response
{
"value": [
{
"$sourceId": "mySourceTwin",
"$relationshipId": "firstRelationshipId",
"$targetId": "targetTwinId",
"$relationshipName": "myRelationship",
"$etag": "W/\"1553dbf5-0052-4be8-bea8-46269075b503\"",
"property": "value"
},
{
"$sourceId": "mySourceTwin",
"$relationshipId": "secondRelationshipId",
"$targetId": "targetTwinId",
"$relationshipName": "myRelationship",
"$etag": "W/\"2552a0a7-0666-4d5e-a67f-ece5b9b81fe0\"",
"property": "value"
}
],
"nextLink": "url-to-next-page"
}
List relationships by name
Sample request
GET https://digitaltwins-hostname/digitaltwins/mySourceTwin/relationships?relationshipName=myRelationship&api-version=2023-10-31
Sample response
{
"value": [
{
"$sourceId": "mySourceTwin",
"$relationshipId": "firstRelationshipId",
"$targetId": "targetTwinId",
"$relationshipName": "myRelationship",
"$etag": "W/\"1553dbf5-0052-4be8-bea8-46269075b503\"",
"property": "value"
},
{
"$sourceId": "mySourceTwin",
"$relationshipId": "secondRelationshipId",
"$targetId": "targetTwinId",
"$relationshipName": "myRelationship",
"$etag": "W/\"2552a0a7-0666-4d5e-a67f-ece5b9b81fe0\"",
"property": "value"
}
],
"nextLink": "url-to-next-page"
}
Definitions
Name | Description |
---|---|
Error |
Error definition. |
Error |
Error response. |
Inner |
A more specific error description than was provided by the containing error. |
Relationship |
A collection of relationships which relate digital twins together. |
Error
Error definition.
Name | Type | Description |
---|---|---|
code |
string |
Service specific error code which serves as the substatus for the HTTP error code. |
details |
Error[] |
Internal error details. |
innererror |
An object containing more specific information than the current object about the error. |
|
message |
string |
A human-readable representation of the error. |
ErrorResponse
Error response.
Name | Type | Description |
---|---|---|
error |
The error details. |
InnerError
A more specific error description than was provided by the containing error.
Name | Type | Description |
---|---|---|
code |
string |
A more specific error code than was provided by the containing error. |
innererror |
An object containing more specific information than the current object about the error. |
RelationshipCollection
A collection of relationships which relate digital twins together.
Name | Type | Description |
---|---|---|
nextLink |
string |
A URI to retrieve the next page of objects. |
value |
object[] |
The relationship objects. |