保存用户属性值
1. 接口说明
用于保存/新增 用户的自定义属性值,同一用户同一属性名已存在时执行覆盖更新,不存在时新增。。
2. 接口URL
POST http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/userPropertyValue/save
anymetrics_host:anymetrics_port 获取方式请参考:调用方式
3. 公共请求参数(HEADERS)
| 参数 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| tenant-id | String | 是 | 租户 ID,用于标识资源所属租户 |
| auth-type | String | 是 | 认证方式: UID:使用 UID 认证 TOKEN:使用 TOKEN 认证 ACCOUNT:使用 ACCOUNT 认证 |
| auth-value | String | 是 | 与 auth-type 对应的认证值 |
3.1 公共参数获取方式
tenant-id 与 auth-value:在 Aloudata CAN 顶部导航栏选择指标应用,左边菜单栏选择 API 集成。在 API 集成界面获取租户 ID 与认证值。

3.2. 请求体参数:
| 参数 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| identityType | String | 是 | 用户标识类型(USER_ID 或 USER_ACCOUNT) |
| userPropertyRequests | Array | 是 | 用户属性请求列表 |
| ∟ identityValue | String | 是 | 用户标识值列表(用户ID列表或用户账号列表) |
| ∟ properties | Array | 是 | 属性列表 |
| ∟∟ name | String | 是 | 属性名称 |
| ∟∟ value | String | 是 | 属性值 |
4. 请求示例:
curl --location 'http://localhost:8083/anymetrics/api/v1/userPropertyValue/save' \
--header 'tenant-id: tn_21571046' \
--header 'auth-value: authority_test' \
--header 'auth-type: ACCOUNT' \
--header 'Content-Type: application/json' \
--data '{
"identityType": "USER_ACCOUNT",
"userPropertyRequests": [
{
"identityValue": "zhangsan",
"properties": [
{ "name": "job_level", "value": "P6" },
{ "name": "region", "value": "east" }
]
}
]
}'