logo
開發者文件
搜尋
查詢用戶屬性

查詢用戶屬性

允許開發者透過指定用戶 ID 或匿名用戶 ID 查詢用戶屬性。每次請求最多可批量查詢 100 個用戶 ID 或匿名用戶 ID。

請求方法

GET

請求 URL

https://api-${endpoint}.gptbots.ai/v2/user-property/query

驗證

請參考 API 參考文件中的[概述]部分。

請求

請求範例

curl -X GET 'https://api-${endpoint}.gptbots.ai/v2/user-property/query' \ -H 'Authorization: Bearer ${token}' \ -d '{ "user_ids": [ "example_user_id_1", "example_user_id_2" ], "anonymous_ids": [ "example_anonymous_id_1", "example_anonymous_id_2" ] }'
                      
                      curl -X GET 'https://api-${endpoint}.gptbots.ai/v2/user-property/query'  \
-H 'Authorization: Bearer ${token}' \
-d '{
      "user_ids": [
        "example_user_id_1",
        "example_user_id_2"
      ],
      "anonymous_ids": [
        "example_anonymous_id_1",
        "example_anonymous_id_2"
      ]
}'

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer ${API Key} 使用 Authorization: Bearer ${API Key} 進行驗證,從 API Keys 頁面獲取 token。

請求內容

參數 類型 描述 必填
user_ids string 要查詢屬性的用戶 ID 必填,與 anonymous_ids 互斥
anonymous_ids string 要查詢屬性的匿名用戶 ID 必填,與 user_ids 互斥

必須提供 user_ids 或 anonymous_ids 其中之一。若同時提供,則優先使用 user_ids。

回應

回應內容

{ { "user_id": "example_user_id_1", "property_values": [ { "property_name": "example_property_name", "value": "example_value" }, { "property_name": "example_property_name", "value": "example_value" } ] }, { "anonymous_id": "example_anonymous_id_2", "property_values": [ { "property_name": "example_property_name", "value": "example_value" }, { "property_name": "example_property_name", "value": "example_value" } ] } }
                      
                      {
  {
    "user_id": "example_user_id_1",
    "property_values": [
      {
        "property_name": "example_property_name",
        "value": "example_value"
      },
      {
        "property_name": "example_property_name",
        "value": "example_value"
      }
    ]
  },
  {
    "anonymous_id": "example_anonymous_id_2",
    "property_values": [
      {
        "property_name": "example_property_name",
        "value": "example_value"
      },
      {
        "property_name": "example_property_name",
        "value": "example_value"
      }
    ]
  }
}

                    
此代碼塊在浮窗中顯示

成功回應

參數 類型 描述
user_id string 查詢的用戶 ID
anonymous_id string 查詢的匿名用戶 ID
property_values list 該 user_id 或 anonymous_id 的用戶屬性及其值列表
property_name string 用戶屬性名稱
value object 用戶屬性的值

錯誤回應

參數 類型 描述
code int 錯誤代碼
message string 錯誤訊息

狀態碼

狀態碼 描述
200 成功
400 參數無效
401 未授權
403 禁止訪問
500 伺服器內部錯誤
503 找不到用戶 ID
504 找不到匿名用戶 ID