Update a Relationship
API Description
Use this API to update a dataset relationship in the metrics platform.
API URL
POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/relation/update
For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.
Request Parameters
Common Request Parameters (Headers)
| Parameter | Type | Required | Description |
|---|---|---|---|
| tenant-id | String | Yes | Tenant ID. Identifies the tenant for metric query content. |
| auth-type | String | Yes | Authentication method. Supported values: UID, TOKEN, ACCOUNT, and APIKEY. |
| auth-value | String | Yes | Authentication value corresponding to auth-type. |
How to Obtain Common Parameters
To obtain tenant-id, select a metrics application in the top navigation bar of Aloudata CAN, choose API Integration from the left navigation menu, and copy it from the API Integration page. Set auth-value according to the selected auth-type.

Body Request Parameters
| Parameter | Type | Required | Maximum Length | Description | Example |
|---|---|---|---|---|---|
| id | String | Yes | 128 | Relationship ID to update. | 1772 |
| relationName | String | Yes | 128 | Relationship English name or identifier. It is also required when updating a relationship. | rel_fact_shop |
| relationDisplayName | String | Yes | 128 | Relationship display name. It is also required when updating a relationship. | Order-store relationship |
| type | String | Yes | 32 | Relationship type. Enumerated values: ONE_TO_ONE, MANY_TO_ONE. |
MANY_TO_ONE |
| srcDatasetName | String | Yes | 128 | Source dataset name. Enter the AnyMetrics dataset name, not the physical table name. | fact_orders |
| dstDatasetName | String | Yes | 128 | Destination dataset name. Enter the AnyMetrics dataset name, not the physical table name. | dim_shop |
| relationConditions | List | Yes | - | Relationship condition list. See the relationConditions parameter description. | - |
relationConditions Parameter Description
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| srcExpr | String | Yes | Source dataset field expression. | [fact_orders/shop_code] |
| dstExpr | String | Yes | Destination dataset field expression. | [dim_shop/tr_shop_code] |
Response Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | String | Yes | API response code. |
| success | Boolean | Yes | Whether the request succeeded. |
| errorMsg | String | No | Error message. |
| detailErrorMsg | String | No | Detailed error message. |
| traceId | String | Yes | Trace ID for troubleshooting. |
| data | String | Yes | Updated relationship ID. |
Request Example
{
"id": "1772",
"relationName": "rel_fact_shop",
"relationDisplayName": "Order-store relationship",
"srcDatasetName": "fact_orders",
"type": "MANY_TO_ONE",
"relationConditions": [
{
"srcExpr": "[fact_orders/shop_code]",
"dstExpr": "[dim_shop/tr_shop_code]"
}
],
"dstDatasetName": "dim_shop"
}