跳到内容

Geozones API

getNearestZone

Anchor link to

由 SDK 内部调用。检索最近 Geozone 的参数及其距离。同时记录设备位置以便发送地理位置推送通知。

POST https://api.pushwoosh.com/json/1.3/getNearestZone

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
applicationstringYesPushwoosh Application code
hwidstringYes/registerDevice 请求中使用的 Hardware device ID
latstringYes设备的纬度。
lngstringYes设备的经度。

Request example

Anchor link to
{
"request": {
"application": "APPLICATION_CODE",
"hwid": "HWID",
"lat": 10.12345,
"lng": 28.12345
}
}

PHP example

Anchor link to
// See http://gomoob.github.io/php-pushwoosh/get-nearest-zone.html
use Gomoob\Pushwoosh\Model\Request\GetNearestZoneRequest;
// Creates the request instance
$request = GetNearestZoneRequest::create()
->setHwid('HWID')
->setLat(10.12345)
->setLng(28.12345);
// Call the '/getNearestZone' Web Service
$response = $pushwoosh->getNearestZone($request);
if ($response->isOk()) {
print 'Zone name : ' . $response->getResponse()->getName();
print 'Latitude : ' . $response->getResponse()->getLat();
print 'Longitude : ' . $response->getResponse()->getLng();
print 'Range : ' . $response->getResponse()->getRange();
print 'Distance : ' . $response->getResponse()->getDistance();
} else {
print 'Oops, the operation failed :-(';
print 'Status code : ' . $response->getStatusCode();
print 'Status message : ' . $response->getStatusMessage();
}

addGeoZone

Anchor link to

向特定应用添加 Geozone。

POST https://api.pushwoosh.com/json/1.3/addGeoZone

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code
geozonesarrayYes作为 JSON 数组的 Geozone 参数。
geozones.namestringYesGeozone 名称。
geozones.latstringYesGeozone 纬度。
geozones.lngstringYesGeozone 经度。
geozones.cooldownintegerYes发送通知后的静默期(以秒为单位)。
geozones.rangeintegerYesGeozone 范围(以米为单位,从 50 到 1000)。
geozones.contentstring or objectRequired if presetCode is empty.Geozone 消息内容。
geozones.presetCodestringRequired if content is empty.用于替代 contentPush preset
geozones.clusterstringNo指定 null 以从 Geozone 解绑 Cluster。
geozones.campaignstringNo指定 null 以从 Geozone 解绑 Campaign。如果省略,Campaign 值保持不变。注意:优先级高于预设中的 Campaign。
geozones.timetableobjectNo设置时间表间隔。

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX", // Pushwoosh application code
"geozones": [{
"name": "Statue of George", // required. Geozone name.
"lat": "40.70087797", // required. Geozone latitude.
"lng": "-73.931851387", // required. Geozone longitude.
"cooldown": 60, // in seconds, required. Silent period after sending a notification
"range": 50, // in meters, from 50 to 1000, required. Range of the geozone.
"content": "Lorem ipsum dolor sit amet,
consectetur adipiscing elit.", // or object
"presetCode": "AAAAA-BBBBB", // optional. Push preset could be used instead of content
"cluster": "GEOZONE CLUSTER CODE", // optional. Cluster's cooldown period will be applied
"campaign": "CAMPAIGN_CODE", // optional. Specify null to unbind Campaign from Geozone
"timetable": { // optional
"timezone": 1234, // in seconds
"Mon": [ // available days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. Push sending
{
"start": "04:11",
"stop": "12:00"
}
],
"Sun": [
{ // one or two intervals
"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

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
geoZoneIdstringYes来自 /addGeoZone 请求的 Geozone ID
namestringNo新的 Geozone 名称。
cooldownintegerNo要更新的冷却时间(以秒为单位)。
statusintegerNo0 - 停用,1 - 激活。
contentstringNoGeozone 推送通知的内容。不能与 presetCode 一起使用。
clusterstringNo新的 Cluster 名称。指定 null 以从 Geozone 解绑 Cluster。
campaignstringNo新的 Campaign ID。指定 null 以从 Geozone 解绑 Campaign。如果省略,Campaign 值将不会改变。优先级高于预设中的 Campaign。
latnumberNoGeozone 纬度。
lngnumberNoGeozone 经度。
rangeintegerNo新的范围(以米为单位)。
timetableobjectNoGeozone 时间表。查看下方更多信息。

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"geoZoneId": 100016750, // required, from /addGeoZone method
"name": "new geozone name", // optional
"cooldown": 222, // in seconds, optional
"status": 0, // optional, 0 - deactivated, 1 - activated
"presetCode": "BBBBB-AAAAA", // optional, cannot be used along with "content"
"content": "new geozone content", // optional, cannot be used along with "presetCode"
"cluster": "GEOZONE CLUSTER CODE", // optional. Specify null to unbind cluster from Geozone
"campaign": "CAMPAIGN_CODE", // optional. Specify null to unbind Campaign from Geozone
"lat": 10.56, // optional, geozone latitude
"lng": 12.523, // optional, geozone longitude
"range": 500, // optional, geozone range
"timetable": { // optional
"timezone": 1234, // in seconds
"Mon": [ // available days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. Push sending
{
"start": "04:11",
"stop": "12:00"
}
],
"Sun": [
{ // one or two intervals
"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

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code
geozonesstringYes要移除的 Geozone 的 ID 数组或 单个 ID

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"application": "XXXXX-XXXXX", // required, Pushwoosh application code
"geozones": [550, 526] // required, geozones IDs
}
}

addGeoZoneCluster

Anchor link to

向应用添加 Geozone Cluster。

POST https://api.pushwoosh.com/json/1.3/addGeoZoneCluster

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code
namestringYesCluster 名称。
cooldownintegerYes单个用户从该 Geozone Cluster 接收相同消息之前的延迟(以秒为单位)。

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"application": "XXXXX-XXXXX", // required, Pushwoosh application code
"name": "Raccoon city", // required, cluster name
"cooldown": 3210 // required, in seconds
}
}

deleteGeoZoneCluster

Anchor link to

从应用中移除 Geozone Cluster。

POST https://api.pushwoosh.com/json/1.3/deleteGeoZoneCluster

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code
geoZoneClusterstringYes要移除的 Geozone Cluster 的 ID。

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"application": "XXXXX-XXXXX", // required, Pushwoosh application code
"geoZoneCluster": "EA1CE-69405" // required, cluster ID obtained from the /addGeoZoneCluster request
}
}

listGeoZones

Anchor link to

检索应用的 Geozones 列表。

POST https://api.pushwoosh.com/json/1.3/listGeoZones

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"application": "XXXXX-XXXXX" // required, Pushwoosh application code
}
}

listGeoZoneClusters

Anchor link to

检索应用的 Geozone Clusters 列表。

POST https://api.pushwoosh.com/json/1.3/listGeoZoneClusters

Request body parameters

Anchor link to
ParameterTypeRequiredDescription
authstringYes来自 Pushwoosh Control Panel 的 API access token
applicationstringYesPushwoosh Application code

Request example

Anchor link to
{
"request": {
"auth": "yxoPUlwqm............pIyEX4H", // required, API access token from Pushwoosh Control
"application": "XXXXX-XXXXX" // required, Pushwoosh application code
}
}