logo
开发者文档
搜索
更新用户属性

更新用户属性

支持通过 API 批量更新用户属性值,开发者可以根据业务需求,灵活设置用户属性,以便更好地进行用户画像和推荐。

请求方式

POST

调用地址

https://api-${endpoint}.gptbots.ai/v1/property/update

Request Authentication

详情参见 API 概述的鉴权方式说明。

请求

请求示例

curl -X POST "https://api-${endpoint}.gptbots.ai/v1/property/update" \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "user_id": "example_user_id", "property_values": [ { "property_name": "example_property_name", "value": "example_value" } ] }'
                      
                      curl -X POST "https://api-${endpoint}.gptbots.ai/v1/property/update" \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
  "user_id": "example_user_id",
  "property_values": [
    {
      "property_name": "example_property_name",
      "value": "example_value"
    }
  ]
}'

                    
此代码块在浮窗中显示

请求头

字段 类型 说明
Authorization Bearer ${token} 使用 Authorization: Bearer ${token}进行调用验证,请在 API 密钥页面获取密钥作为 token。
Content-Type application/json 数据类型,取值为 application/json。

请求参数

参数 类型 说明 required
user_id string 需要设置用户属性的用户id true
property_values list 待更新的属性列表 true
property_values.property_name string 属性名称 true
property_values.value object 属性值 true

响应

参数 类型 说明
success_update list 成功更新的用户属性列表
success_update.propertyName string 成功更新的属性名称
success_update.value object 成功更新的属性值
fail_update list 更新失败的用户属性列表
fail_update.value object 更新失败的属性值
fail_update.property_name string 新失败的属性名称