สอบถามคุณสมบัติผู้ใช้

สอบถามคุณสมบัติผู้ใช้

ให้นักพัฒนาสามารถสอบถามคุณสมบัติของผู้ใช้ได้โดยระบุ user ID หรือ anonymous user ID รองรับการสอบถามแบบกลุ่มสูงสุด 100 user ID หรือ anonymous user ID ต่อครั้ง

วิธีการร้องขอ

GET

URL สำหรับร้องขอ

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

การยืนยันตัวตน

โปรดดูที่ ภาพรวม ใน API Reference

คำขอ

ตัวอย่างคำขอ

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"
      ]
}'

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

Request Headers

ฟิลด์ ประเภท คำอธิบาย
Authorization Bearer ${API Key} การยืนยันตัวตนโดยใช้ Authorization: Bearer ${API Key} รับ token ได้จากหน้า API Keys

Request Body

พารามิเตอร์ ประเภท คำอธิบาย จำเป็นหรือไม่
user_ids string User ID ที่ต้องการสอบถามคุณสมบัติ จำเป็น, ไม่สามารถใช้ร่วมกับ anonymous_ids
anonymous_ids string Anonymous user ID ที่ต้องการสอบถามคุณสมบัติ จำเป็น, ไม่สามารถใช้ร่วมกับ user_ids

ต้องระบุ user_ids หรือ anonymous_ids อย่างใดอย่างหนึ่ง หากระบุทั้งสอง user_ids จะมีลำดับความสำคัญกว่า

การตอบกลับ

Response Body

{ { "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 User ID ที่สอบถาม
anonymous_id string Anonymous user ID ที่สอบถาม
property_values list รายการคุณสมบัติผู้ใช้และค่าของแต่ละ user_id
property_name string ชื่อคุณสมบัติของผู้ใช้
value object ค่าของคุณสมบัติผู้ใช้

การตอบกลับเมื่อเกิดข้อผิดพลาด

พารามิเตอร์ ประเภท คำอธิบาย
code int รหัสข้อผิดพลาด
message string ข้อความข้อผิดพลาด

รหัสสถานะ

รหัสสถานะ คำอธิบาย
200 สำเร็จ
400 พารามิเตอร์ไม่ถูกต้อง
401 ไม่ได้รับอนุญาต
403 ถูกปฏิเสธการเข้าถึง
500 ข้อผิดพลาดของเซิร์ฟเวอร์
503 ไม่พบ User ID
504 ไม่พบ Anonymous User ID