Twins - DigitalTwins UpdateRelationship

Updates the properties on a relationship between two digital twins. Status codes:

  • 204 No Content
  • 400 Bad Request
    • InvalidArgument - The digital twin id or relationship id is invalid.
    • InvalidRelationship - The relationship is invalid.
    • JsonPatchInvalid - The JSON Patch provided is invalid.
    • ValidationFailed - The relationship content is invalid.
  • 404 Not Found
    • DigitalTwinNotFound - The digital twin was not found.
    • RelationshipNotFound - The relationship was not found.
  • 409 Conflict
    • RelationshipAlreadyExists - The relationship already exists.
  • 412 Precondition Failed
    • PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
PATCH https://digitaltwins-hostname/digitaltwins/{id}/relationships/{relationshipId}?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.

relationshipId
path True

string

The id of the relationship. The id is unique within the digital twin and case sensitive.

api-version
query True

string

The requested API version.

Request Header

Media Types: "application/json-patch+json"

Name Required Type Description
If-Match

string

Only perform the operation if the entity's etag matches one of the etags provided or * is provided.

traceparent

string

Identifies the request in a distributed tracing system.

tracestate

string

Provides vendor-specific trace identification information and is a companion to traceparent.

Request Body

Media Types: "application/json-patch+json"

Name Type Description
patchDocument

object[]

JSON Patch description of the update to the relationship properties.

Responses

Name Type Description
204 No Content

Success

Headers

ETag: string

Other Status Codes

ErrorResponse

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

Update relationship properties
Update relationship properties (multiple updates)

Update relationship properties

Sample request

PATCH https://digitaltwins-hostname/digitaltwins/myTwinId/relationships/myRelationshipId?api-version=2023-10-31

[
  {
    "op": "add",
    "path": "/property",
    "value": 1
  }
]

Sample response

Update relationship properties (multiple updates)

Sample request

PATCH https://digitaltwins-hostname/digitaltwins/myTwinId/relationships/myRelationshipId?api-version=2023-10-31

[
  {
    "op": "add",
    "path": "/property1",
    "value": 1
  },
  {
    "op": "remove",
    "path": "/property2"
  },
  {
    "op": "replace",
    "path": "/property3/subProperty1",
    "value": "new value"
  }
]

Sample response

Definitions

Name Description
Error

Error definition.

ErrorResponse

Error response.

InnerError

A more specific error description than was provided by the containing error.

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

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

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

InnerError

An object containing more specific information than the current object about the error.