[Go to site: main page, start]

ข้ามไปยังเนื้อหา

Audience API

bulkSetTags

Anchor link to

POST https://api.pushwoosh.com/api/v2/audience/bulkSetTags

ตั้งค่าแท็กสำหรับรายการอุปกรณ์

Request Body

Anchor link to
ชื่อประเภทคำอธิบาย
application*Stringรหัสแอปพลิเคชัน Pushwoosh
auth*Stringโทเค็นการเข้าถึง API จาก Pushwoosh Control Panel
create_missing_tagsBooleanหากเป็น true แท็กที่ไม่มีอยู่จะถูกสร้างขึ้นโดยอัตโนมัติ
devices*Objectอาร์เรย์ของอุปกรณ์
devices.hwidStringสามารถใช้เพื่อระบุอุปกรณ์แทน user_id หรือ push_token เรียนรู้เพิ่มเติม
devices.user_idStringสามารถใช้เพื่อระบุผู้ใช้แทน hwid หรือ push_token เรียนรู้เพิ่มเติม
devices.push_tokenStringสามารถใช้เพื่อระบุอุปกรณ์แทน hwid หรือ user_id เรียนรู้เพิ่มเติม
devices.list_operatorStringกำหนดวิธีการตั้งค่าสำหรับ แท็ก ประเภทรายการ: set, append หรือ remove
devices.tags*Objectค่าที่จะตั้งสำหรับแท็กที่ระบุ
{
"request_id": "request_id to use in GET method to obtain job status",
"status": "Pending"
}
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"
}
}]
}
Response:
{
"request_id": "request_id to use in GET method to obtain job status",
"status": "Pending"
}

สถานะ bulkSetTags

Anchor link to

GET https://api.pushwoosh.com/api/v2/audience/bulkSetTags/{request_id}?detailed=false

ส่งคืนสถานะของการดำเนินการ /bulkSetTags

พารามิเตอร์ Path

Anchor link to
ชื่อประเภทคำอธิบาย
request_idStringrequest id จากการเรียก /bulkSetTags ก่อนหน้า

พารามิเตอร์ Query

Anchor link to
ชื่อประเภทคำอธิบาย
detailedBoolean(true/false) ว่าจะส่งคืนข้อมูลโดยละเอียดต่ออุปกรณ์หรือไม่
Response:
{
"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
พารามิเตอร์ประเภทจำเป็นคำอธิบาย
applicationstringใช่รหัสแอปพลิเคชัน Pushwoosh
authstringใช่โทเค็นการเข้าถึง API
devicesarrayใช่อาร์เรย์ของออบเจ็กต์อุปกรณ์ แต่ละออบเจ็กต์แสดงถึงอุปกรณ์และข้อมูลที่เกี่ยวข้อง ดูรายละเอียดในตาราง พารามิเตอร์ออบเจ็กต์อุปกรณ์ ด้านล่าง

พารามิเตอร์ออบเจ็กต์อุปกรณ์

Anchor link to
พารามิเตอร์ประเภทจำเป็นคำอธิบาย
hwidstringใช่Hardware ID หรือตัวระบุที่ไม่ซ้ำกันสำหรับอุปกรณ์
push_tokenstringใช่Push token สำหรับอุปกรณ์
platformintegerใช่ตัวระบุแพลตฟอร์ม เรียนรู้เพิ่มเติม
list_operatorstringไม่กำหนดการดำเนินการสำหรับแท็กประเภทรายการ:
- “append”: เพิ่มค่าที่ระบุลงในรายการแท็ก
- “remove”: ลบค่าที่ระบุออกจากรายการแท็ก
หมายเหตุ: หากไม่ได้ระบุพารามิเตอร์ list_operator ค่าที่มีอยู่ทั้งหมดในรายการแท็กจะถูกแทนที่ด้วยค่าที่ให้มา
tagsobjectไม่แท็ก ที่กำหนดเองซึ่งกำหนดให้กับอุปกรณ์ แท็กคือคู่คีย์-ค่าที่ใช้สำหรับการแบ่งกลุ่ม

ตัวอย่าง 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"
}
}]
}

เมธอดจะตอบกลับด้วย 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_idstringใช่request ID ที่ส่งคืนโดยคำขอ POST
detailedbooleanไม่หากตั้งค่าเป็น 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
พารามิเตอร์ประเภทจำเป็นคำอธิบาย
applicationstringใช่รหัสแอปพลิเคชัน Pushwoosh
authstringใช่โทเค็นการเข้าถึง API
devicesarrayใช่อาร์เรย์ของออบเจ็กต์อุปกรณ์ แต่ละออบเจ็กต์แสดงถึงอุปกรณ์และข้อมูลที่เกี่ยวข้อง ดูรายละเอียดในตาราง พารามิเตอร์ออบเจ็กต์อุปกรณ์ ด้านล่าง

พารามิเตอร์ออบเจ็กต์อุปกรณ์

Anchor link to
พารามิเตอร์ประเภทจำเป็นคำอธิบาย
hwidstringใช่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.
}]
}

เมธอดจะตอบกลับด้วย 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_idstringใช่request ID ที่ส่งคืนโดยคำขอ POST
detailedbooleanไม่หากตั้งค่าเป็น 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"
}
]
}