Audience API
bulkSetTags
Anchor link toPOST https://api.pushwoosh.com/api/v2/audience/bulkSetTags
ตั้งค่าแท็กสำหรับรายการอุปกรณ์
Request Body
Anchor link to| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
| application* | String | รหัสแอปพลิเคชัน Pushwoosh |
| auth* | String | โทเค็นการเข้าถึง API จาก Pushwoosh Control Panel |
| create_missing_tags | Boolean | หากเป็น true แท็กที่ไม่มีอยู่จะถูกสร้างขึ้นโดยอัตโนมัติ |
| devices* | Object | อาร์เรย์ของอุปกรณ์ |
| devices.hwid | String | สามารถใช้เพื่อระบุอุปกรณ์แทน user_id หรือ push_token เรียนรู้เพิ่มเติม |
| devices.user_id | String | สามารถใช้เพื่อระบุผู้ใช้แทน hwid หรือ push_token เรียนรู้เพิ่มเติม |
| devices.push_token | String | สามารถใช้เพื่อระบุอุปกรณ์แทน hwid หรือ user_id เรียนรู้เพิ่มเติม |
| devices.list_operator | String | กำหนดวิธีการตั้งค่าสำหรับ แท็ก ประเภทรายการ: set, append หรือ remove |
| devices.tags* | Object | ค่าที่จะตั้งสำหรับแท็กที่ระบุ |
{ "request_id": "request_id to use in GET method to obtain job status", "status": "Pending"}{ "message": "invalid request"}{ "application": "application code", // required. Pushwoosh app code "auth": "Pushwoosh auth token", // required. API access token from Pushwoosh Control Panel "create_missing_tags": false, // optional. Should automatically create missing tags "devices": [{ // required. Array of devices "hwid": "device hwid", // optional. Can be used to identify a device instead of // "user_id" or "push_token". "user_id": "user ID", // optional. Can be used to identify a user instead of "hwid" or "push_token". "push_token": "device push token", // optional. Can be used to identify a device instead of "hwid" or "user_id". "list_operator": "set", // required. For list tags. Defines how to set values for // tags of the list type: set, append, or remove "tags": { // required. Values to set for the tags specified. "tag_name": "tagvalue", // use correct value type "tag_name2": "tagvalue2" } }]}{ "request_id": "request_id to use in GET method to obtain job status", "status": "Pending"}สถานะ bulkSetTags
Anchor link toGET https://api.pushwoosh.com/api/v2/audience/bulkSetTags/{request_id}?detailed=false
ส่งคืนสถานะของการดำเนินการ /bulkSetTags
พารามิเตอร์ Path
Anchor link to| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
| request_id | String | request id จากการเรียก /bulkSetTags ก่อนหน้า |
พารามิเตอร์ Query
Anchor link to| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
| detailed | Boolean | (true/false) ว่าจะส่งคืนข้อมูลโดยละเอียดต่ออุปกรณ์หรือไม่ |
{ "request_id": "id of the request", "status": "Completed", // also "Pending", "Failed" "progress": 100, // jobs progress 0-100 "devices_success": 100, // good devices "devices_not_found": 0, // devices not found in Pushwoosh "devices_failed": 0, // errored "devices": [{ // device report (only in detailed = true) "hwid": "device hwid", "status": "done", // also "failed", "not found" "tags": { "tagName": "ok", "tagName2": "tag not found", "tagName3": "wrong value. expect :string" } }]}bulkRegisterDevice
Anchor link toลงทะเบียนอุปกรณ์หลายเครื่องใน Pushwoosh ในคำขอเดียว นอกจากนี้ยังอนุญาตให้ระบุแท็กต่างๆ สำหรับแต่ละอุปกรณ์ได้อีกด้วย
POST https://api.pushwoosh.com/api/v2/audience/bulkRegisterDevice
พารามิเตอร์ของ Request body
Anchor link to| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
| auth | string | ใช่ | โทเค็นการเข้าถึง API |
| devices | array | ใช่ | อาร์เรย์ของออบเจ็กต์อุปกรณ์ แต่ละออบเจ็กต์แสดงถึงอุปกรณ์และข้อมูลที่เกี่ยวข้อง ดูรายละเอียดในตาราง พารามิเตอร์ออบเจ็กต์อุปกรณ์ ด้านล่าง |
พารามิเตอร์ออบเจ็กต์อุปกรณ์
Anchor link to| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| hwid | string | ใช่ | Hardware ID หรือตัวระบุที่ไม่ซ้ำกันสำหรับอุปกรณ์ |
| push_token | string | ใช่ | Push token สำหรับอุปกรณ์ |
| platform | integer | ใช่ | ตัวระบุแพลตฟอร์ม เรียนรู้เพิ่มเติม |
| list_operator | string | ไม่ | กำหนดการดำเนินการสำหรับแท็กประเภทรายการ: - “append”: เพิ่มค่าที่ระบุลงในรายการแท็ก - “remove”: ลบค่าที่ระบุออกจากรายการแท็ก หมายเหตุ: หากไม่ได้ระบุพารามิเตอร์ list_operator ค่าที่มีอยู่ทั้งหมดในรายการแท็กจะถูกแทนที่ด้วยค่าที่ให้มา |
| tags | object | ไม่ | แท็ก ที่กำหนดเองซึ่งกำหนดให้กับอุปกรณ์ แท็กคือคู่คีย์-ค่าที่ใช้สำหรับการแบ่งกลุ่ม |
ตัวอย่าง Request
Anchor link to{ "application": "application code", // required. Pushwoosh app code "auth": "Pushwoosh auth token", // required. API access token from Pushwoosh Control Panel "devices": [{ // required. Array of devices "hwid": "device hwid", // required. Unique identifier for the device (can be an email). "push_token": "device push token", // required. Push notification token for the device. "platform": 14, // required. Device platform (e.g., 14 for email). "list_operator": "append", // optional. For list tags. Adds or removes the specified value(s) from the tag of list type. "tags": { // optional. Values to set for the specified tags. "language": "en", // use correct value type. "CSV_Import": "summer_camp" } }, { "hwid": "device hwid 2", // required. Unique identifier for the second device. "push_token": "device push token 2", // required. Push notification token for the device. "platform": 14, // required. Device platform. "list_operator": "remove", // optional. Adds or removes values from tags of the list type. "tags": { // optional. Values to remove from the specified tags. "language": "en", "CSV_Import": "summer_camp2" } }, { "hwid": "device hwid 3", // required. Unique identifier for the third device. "push_token": "device push token 3", // required. Push notification token for the device. "platform": 14, // required. Device platform. "tags": { // optional. Values to set for the specified tags. "language": "en", "CSV_Import": "summer_camp3" } }]}Response
Anchor link toเมธอดจะตอบกลับด้วย ID การดำเนินการ ซึ่งสามารถใช้เพื่อติดตามสถานะและผลลัพธ์ของกระบวนการลงทะเบียนจำนวนมากได้
{ "request_id": "request_id to use in GET method to obtain job status", "status": "Pending"}สถานะ bulkRegisterDevice
Anchor link toคุณสามารถตรวจสอบสถานะของกระบวนการลงทะเบียนจำนวนมากได้โดยการส่งคำขอ GET ต่อไปนี้:
GET https://api.pushwoosh.com/api/v2/audience/bulkRegisterDevice/{request_id}?detailed=true
| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| request_id | string | ใช่ | request ID ที่ส่งคืนโดยคำขอ POST |
| detailed | boolean | ไม่ | หากตั้งค่าเป็น true การตอบกลับจะรวมผลลัพธ์โดยละเอียดสำหรับแต่ละอุปกรณ์ที่ลงทะเบียน |
ตัวอย่าง Response
Anchor link to{ "request_id": "9a2e1a14-XXXX-46c3-XXXX-c254b25d3782", "status": "Completed", "progress": 100, "devices_success": 4, "devices": [ { "hwid": "user1@example.com", "status": "done" }, { "hwid": "user2@example.com", "status": "done" }, { "hwid": "user3@example.com", "status": "done" }, { "hwid": "invalid_email@example.com", "status": "failed" } ]}bulkUnregisterDevice
Anchor link toยกเลิกการลงทะเบียนอุปกรณ์หลายเครื่องจาก Pushwoosh ในคำขอเดียว
POST https://api.pushwoosh.com/api/v2/audience/bulkUnregisterDevice
พารามิเตอร์ของ Request body
Anchor link to| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
| auth | string | ใช่ | โทเค็นการเข้าถึง API |
| devices | array | ใช่ | อาร์เรย์ของออบเจ็กต์อุปกรณ์ แต่ละออบเจ็กต์แสดงถึงอุปกรณ์และข้อมูลที่เกี่ยวข้อง ดูรายละเอียดในตาราง พารามิเตอร์ออบเจ็กต์อุปกรณ์ ด้านล่าง |
พารามิเตอร์ออบเจ็กต์อุปกรณ์
Anchor link to| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| hwid | string | ใช่ | Hardware ID หรือตัวระบุที่ไม่ซ้ำกันสำหรับอุปกรณ์ เรียนรู้เพิ่มเติม |
ตัวอย่าง Request
Anchor link to{ "application": "application code", // required. Pushwoosh app code "auth": "Pushwoosh auth token", // required. API access token from Pushwoosh Control Panel "devices": [{ // required. Array of devices "hwid": "device hwid", // required. Unique identifier for the device (can be an email). }, { "hwid": "device hwid 2", // required. Unique identifier for the second device. }, { "hwid": "device hwid 3", // required. Unique identifier for the third device. }]}Response
Anchor link toเมธอดจะตอบกลับด้วย ID การดำเนินการ ซึ่งสามารถใช้เพื่อติดตามสถานะและผลลัพธ์ของกระบวนการจำนวนมากได้
{ "request_id": "request_id to use in GET method to obtain job status", "status": "Pending"}สถานะ bulkUnregisterDevice
Anchor link toคุณสามารถตรวจสอบสถานะของกระบวนการยกเลิกการลงทะเบียนจำนวนมากได้โดยการส่งคำขอ GET ต่อไปนี้:
GET https://api.pushwoosh.com/api/v2/audience/bulkUnregisterDevice/{request_id}?detailed=true
| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| request_id | string | ใช่ | request ID ที่ส่งคืนโดยคำขอ POST |
| detailed | boolean | ไม่ | หากตั้งค่าเป็น true การตอบกลับจะรวมผลลัพธ์โดยละเอียดสำหรับแต่ละอุปกรณ์ที่ยกเลิกการลงทะเบียน |
ตัวอย่าง Response
Anchor link to{ "request_id": "9a2e1a14-XXXX-46c3-XXXX-c254b25d3782", "status": "Completed", "progress": 100, "devices_success": 4, "devices": [ { "hwid": "user1@example.com", "status": "done" }, { "hwid": "user2@example.com", "status": "done" }, { "hwid": "user3@example.com", "status": "done" }, { "hwid": "invalid_email@example.com", "status": "failed" } ]}