Geozones API
getNearestZone
Anchor link toเรียกใช้ภายในจาก SDK ดึงข้อมูลพารามิเตอร์ของ geozone ที่ใกล้ที่สุดและระยะทางไปยังโซนนั้น และยังบันทึกตำแหน่งของอุปกรณ์สำหรับการแจ้งเตือนแบบพุชทางภูมิศาสตร์
POST https://api.pushwoosh.com/json/1.3/getNearestZone
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
hwid | string | ใช่ | ID อุปกรณ์ฮาร์ดแวร์ ที่ใช้ในคำขอ /registerDevice |
lat | string | ใช่ | ละติจูดของอุปกรณ์ |
lng | string | ใช่ | ลองจิจูดของอุปกรณ์ |
ตัวอย่างคำขอ
Anchor link to{ "request": { "application": "APPLICATION_CODE", "hwid": "HWID", "lat": 10.12345, "lng": 28.12345 }}
ตัวอย่าง PHP
Anchor link to// ดูรายละเอียดที่ http://gomoob.github.io/php-pushwoosh/get-nearest-zone.html
use Gomoob\Pushwoosh\Model\Request\GetNearestZoneRequest;
// สร้างอินสแตนซ์ของคำขอ$request = GetNearestZoneRequest::create() ->setHwid('HWID') ->setLat(10.12345) ->setLng(28.12345);
// เรียกใช้ Web Service '/getNearestZone'$response = $pushwoosh->getNearestZone($request);
if ($response->isOk()) { print 'ชื่อโซน : ' . $response->getResponse()->getName(); print 'ละติจูด : ' . $response->getResponse()->getLat(); print 'ลองจิจูด : ' . $response->getResponse()->getLng(); print 'ระยะ : ' . $response->getResponse()->getRange(); print 'ระยะทาง : ' . $response->getResponse()->getDistance();} else { print 'อุ๊ปส์ การดำเนินการล้มเหลว :-('; print 'รหัสสถานะ : ' . $response->getStatusCode(); print 'ข้อความสถานะ : ' . $response->getStatusMessage();}
addGeoZone
Anchor link toเพิ่ม Geozone ไปยังแอปที่ระบุ
POST https://api.pushwoosh.com/json/1.3/addGeoZone
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
geozones | array | ใช่ | พารามิเตอร์ของ Geozone ในรูปแบบอาร์เรย์ JSON |
geozones.name | string | ใช่ | ชื่อ Geozone |
geozones.lat | string | ใช่ | ละติจูดของ Geozone |
geozones.lng | string | ใช่ | ลองจิจูดของ Geozone |
geozones.cooldown | integer | ใช่ | ช่วงเวลาเงียบหลังจากการส่งการแจ้งเตือน (เป็นวินาที) |
geozones.range | integer | ใช่ | ระยะของ Geozone (เป็นเมตร ตั้งแต่ 50 ถึง 1000) |
geozones.content | string or object | จำเป็นหาก presetCode ว่างเปล่า | เนื้อหาข้อความของ Geozone |
geozones.presetCode | string | จำเป็นหาก content ว่างเปล่า | Push preset ที่จะใช้แทน content |
geozones.cluster | string | ไม่ | ระบุ null เพื่อยกเลิกการผูกคลัสเตอร์จาก Geozone |
geozones.campaign | string | ไม่ | ระบุ null เพื่อยกเลิกการผูกแคมเปญจาก Geozone หากไม่ระบุ ค่าแคมเปญจะยังคงไม่เปลี่ยนแปลง หมายเหตุ: มีลำดับความสำคัญสูงกว่าแคมเปญใน preset |
geozones.timetable | object | ไม่ | ตั้งค่าช่วงเวลาตามตารางเวลา |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX", // รหัสแอปพลิเคชัน Pushwoosh "geozones": [{ "name": "Statue of George", // จำเป็น. ชื่อ Geozone "lat": "40.70087797", // จำเป็น. ละติจูดของ Geozone "lng": "-73.931851387", // จำเป็น. ลองจิจูดของ Geozone "cooldown": 60, // เป็นวินาที, จำเป็น. ช่วงเวลาเงียบหลังจากการส่งการแจ้งเตือน "range": 50, // เป็นเมตร, ตั้งแต่ 50 ถึง 1000, จำเป็น. ระยะของ geozone "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", // หรืออ็อบเจกต์ "presetCode": "AAAAA-BBBBB", // ไม่จำเป็น. สามารถใช้ Push preset แทน content ได้ "cluster": "GEOZONE CLUSTER CODE", // ไม่จำเป็น. จะใช้ช่วงเวลา cooldown ของคลัสเตอร์ "campaign": "CAMPAIGN_CODE", // ไม่จำเป็น. ระบุ null เพื่อยกเลิกการผูกแคมเปญจาก Geozone "timetable": { // ไม่จำเป็น "timezone": 1234, // เป็นวินาที "Mon": [ // วันที่ใช้ได้: Mon, Tue, Wed, Thu, Fri, Sat, Sun. การส่งพุช { "start": "04:11", "stop": "12:00" } ], "Sun": [ { // หนึ่งหรือสองช่วงเวลา "start": "01:11", "stop": "17:00" }, { "start": "18:01", "stop": "23:59" } ] } }] }}
updateGeoZone
Anchor link toอัปเดตคุณสมบัติของ Geozone
POST https://api.pushwoosh.com/json/1.3/updateGeoZone
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
geoZoneId | string | ใช่ | ID ของ Geozone จากคำขอ /addGeoZone |
name | string | ไม่ | ชื่อ Geozone ใหม่ |
cooldown | integer | ไม่ | Cooldown ที่จะอัปเดต เป็นวินาที |
status | integer | ไม่ | 0 - ปิดใช้งาน, 1 - เปิดใช้งาน |
content | string | ไม่ | เนื้อหาสำหรับการแจ้งเตือนพุชของ Geozone ไม่สามารถใช้ร่วมกับ presetCode ได้ |
cluster | string | ไม่ | ชื่อคลัสเตอร์ใหม่ ระบุ null เพื่อยกเลิกการผูกคลัสเตอร์จาก Geozone |
campaign | string | ไม่ | ID แคมเปญใหม่ ระบุ null เพื่อยกเลิกการผูกแคมเปญจาก Geozone หากไม่ระบุ ค่าแคมเปญจะไม่เปลี่ยนแปลง มีลำดับความสำคัญสูงกว่าแคมเปญจาก preset |
lat | number | ไม่ | ละติจูดของ Geozone |
lng | number | ไม่ | ลองจิจูดของ Geozone |
range | integer | ไม่ | ระยะใหม่เป็นเมตร |
timetable | object | ไม่ | ตารางเวลาของ Geozone ดูข้อมูลเพิ่มเติมด้านล่าง |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "geoZoneId": 100016750, // จำเป็น, จากเมธอด /addGeoZone "name": "new geozone name", // ไม่จำเป็น "cooldown": 222, // เป็นวินาที, ไม่จำเป็น "status": 0, // ไม่จำเป็น, 0 - ปิดใช้งาน, 1 - เปิดใช้งาน "presetCode": "BBBBB-AAAAA", // ไม่จำเป็น, ไม่สามารถใช้ร่วมกับ "content" ได้ "content": "new geozone content", // ไม่จำเป็น, ไม่สามารถใช้ร่วมกับ "presetCode" ได้ "cluster": "GEOZONE CLUSTER CODE", // ไม่จำเป็น. ระบุ null เพื่อยกเลิกการผูกคลัสเตอร์จาก Geozone "campaign": "CAMPAIGN_CODE", // ไม่จำเป็น. ระบุ null เพื่อยกเลิกการผูกแคมเปญจาก Geozone "lat": 10.56, // ไม่จำเป็น, ละติจูดของ geozone "lng": 12.523, // ไม่จำเป็น, ลองจิจูดของ geozone "range": 500, // ไม่จำเป็น, ระยะของ geozone "timetable": { // ไม่จำเป็น "timezone": 1234, // เป็นวินาที "Mon": [ // วันที่ใช้ได้: Mon, Tue, Wed, Thu, Fri, Sat, Sun. การส่งพุช { "start": "04:11", "stop": "12:00" } ], "Sun": [ { // หนึ่งหรือสองช่วงเวลา "start": "01:11", "stop": "17:00" }, { "start": "18:01", "stop": "23:59" } ] } }}
deleteGeoZone
Anchor link toลบ Geozones ออกจากแอป
POST https://api.pushwoosh.com/json/1.3/deleteGeoZone
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
geozones | string | ใช่ | อาร์เรย์ของ ID หรือ ID เดียวของ Geozone ที่จะลบ |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX", // จำเป็น, รหัสแอปพลิเคชัน Pushwoosh "geozones": [550, 526] // จำเป็น, ID ของ geozones }}
addGeoZoneCluster
Anchor link toเพิ่ม Geozone Cluster ไปยังแอป
POST https://api.pushwoosh.com/json/1.3/addGeoZoneCluster
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
name | string | ใช่ | ชื่อคลัสเตอร์ |
cooldown | integer | ใช่ | ความล่าช้าก่อนที่ผู้ใช้คนเดียวจะสามารถรับข้อความเดียวกันจาก Geozone Cluster ได้อีกครั้ง เป็นวินาที |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX", // จำเป็น, รหัสแอปพลิเคชัน Pushwoosh "name": "Raccoon city", // จำเป็น, ชื่อคลัสเตอร์ "cooldown": 3210 // จำเป็น, เป็นวินาที }}
deleteGeoZoneCluster
Anchor link toลบ Geozone Cluster ออกจากแอป
POST https://api.pushwoosh.com/json/1.3/deleteGeoZoneCluster
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
geoZoneCluster | string | ใช่ | ID ของ Geozone cluster ที่จะลบ |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX", // จำเป็น, รหัสแอปพลิเคชัน Pushwoosh "geoZoneCluster": "EA1CE-69405" // จำเป็น, ID ของคลัสเตอร์ที่ได้รับจากคำขอ /addGeoZoneCluster }}
listGeoZones
Anchor link toดึงรายการ Geozones สำหรับแอป
POST https://api.pushwoosh.com/json/1.3/listGeoZones
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX" // จำเป็น, รหัสแอปพลิเคชัน Pushwoosh }}
listGeoZoneClusters
Anchor link toดึงรายการคลัสเตอร์ Geozone สำหรับแอป
POST https://api.pushwoosh.com/json/1.3/listGeoZoneClusters
พารามิเตอร์ของคำขอ
Anchor link toพารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
auth | string | ใช่ | โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh |
application | string | ใช่ | รหัสแอปพลิเคชัน Pushwoosh |
ตัวอย่างคำขอ
Anchor link to{ "request": { "auth": "yxoPUlwqm............pIyEX4H", // จำเป็น, โทเค็นการเข้าถึง API จากแผงควบคุม Pushwoosh "application": "XXXXX-XXXXX" // จำเป็น, รหัสแอปพลิเคชัน Pushwoosh }}