Twins - DigitalTwins AddRelationship
在兩個數字對應項之間加入關聯性。 狀態碼:
- 200 確定
- 400 不正確的要求
- InvalidArgument - 數位對應項識別碼、關聯性識別碼或承載無效。
- InvalidRelationship - 關聯性無效。
- OperationNotAllowed - 關聯性無法連線到相同的數位對應項。
- ValidationFailed - 關聯性內容無效。
- 404 找不到
- DigitalTwinNotFound - 找不到數位對應項。
- TargetTwinNotFound - 找不到關聯性的數位對應專案標。
- 412 先決條件失敗
- PreconditionFailed - 前置條件檢查 (If-Match 或 If-None-Match) 失敗。
PUT https://digitaltwins-hostname/digitaltwins/{id}/relationships/{relationshipId}?api-version=2023-10-31
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
id
|
path | True |
string |
數位對應項的識別碼。 識別碼在服務內是唯一的,而且區分大小寫。 |
relationship
|
path | True |
string |
關聯性的識別碼。 識別碼在數位對應項和區分大小寫內是唯一的。 |
api-version
|
query | True |
string |
要求的 API 版本。 |
要求標頭
名稱 | 必要 | 類型 | Description |
---|---|---|---|
If-None-Match |
string |
只有在實體不存在時,才執行作業。 |
|
traceparent |
string |
識別分散式追蹤系統中的要求。 |
|
tracestate |
string |
提供廠商特定的追蹤識別資訊,而且是追蹤親和項的隨附專案。 |
要求本文
名稱 | 類型 | Description |
---|---|---|
relationship |
object |
關聯性的資料。 |
回應
名稱 | 類型 | Description |
---|---|---|
200 OK |
Relationship |
Success Headers ETag: string |
Other Status Codes |
預設回應。 Headers x-ms-error-code: string |
安全性
oauth2
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize?resource=0b07f429-9f4b-4714-9392-cc5e8e80c8b0
範例
Create a relationship |
Create a relationship (with properties) |
Create a relationship
Sample Request
PUT https://digitaltwins-hostname/digitaltwins/mySourceTwin/relationships/myRelationshipId?api-version=2023-10-31
{
"$targetId": "myTargetTwin",
"$relationshipName": "myRelationship"
}
Sample Response
{
"$relationshipId": "myRelationshipId",
"$sourceId": "mySourceTwin",
"$targetId": "myTargetTwin",
"$relationshipName": "myRelationship",
"$etag": "W/\"1553dbf5-0052-4be8-bea8-46269075b503\""
}
Create a relationship (with properties)
Sample Request
PUT https://digitaltwins-hostname/digitaltwins/mySourceTwin/relationships/myRelationshipId?api-version=2023-10-31
{
"$targetId": "myTargetTwin",
"$relationshipName": "myRelationship",
"relationshipProperty1": 1,
"relationshipProperty2": "some value"
}
Sample Response
{
"$relationshipId": "myRelationshipId",
"$sourceId": "mySourceTwin",
"$targetId": "myTargetTwin",
"$relationshipName": "myRelationship",
"relationshipProperty1": 1,
"relationshipProperty2": "some value",
"$etag": "W/\"1553dbf5-0052-4be8-bea8-46269075b503\""
}
定義
名稱 | Description |
---|---|
Error |
錯誤定義。 |
Error |
錯誤回應。 |
Inner |
比包含的錯誤所提供更明確的錯誤描述。 |
Error
錯誤定義。
名稱 | 類型 | Description |
---|---|---|
code |
string |
服務特定的錯誤碼,可作為 HTTP 錯誤碼的子狀態。 |
details |
Error[] |
內部錯誤詳細資料。 |
innererror |
物件,包含比目前物件有關錯誤更具體的資訊。 |
|
message |
string |
人類可讀取的錯誤標記法。 |
ErrorResponse
錯誤回應。
名稱 | 類型 | Description |
---|---|---|
error |
錯誤詳細資料。 |
InnerError
比包含的錯誤所提供更明確的錯誤描述。
名稱 | 類型 | Description |
---|---|---|
code |
string |
比包含的錯誤所提供更明確的錯誤碼。 |
innererror |
物件,包含比目前物件有關錯誤更具體的資訊。 |
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應