Geozones

API methods to manage Geozones

post
/getNearestZone

https://cp.pushwoosh.com/json/1.3/getNearestZone
Called internally from the SDK. Gets the parameters of the nearest geozone and a distance to it. Also records the device location for geo push notifications.
Request
Response
Body Parameters
application
required
string
Pushwoosh application code.
hwid
required
string
Hardware device id used in /registerDevice request.
lat
required
string
Latitude of the device.
lng
required
string
Longitude of the device.
200: OK
{
"status_code":200,
"status_message":"OK",
"response": { // returns zone which is the closest to the position provided in the request
"name":"zone name",
"lat":42,
"lng":42,
"range":1234, // range in meters
"distance":4715784 // distance in meters
}
}
Example
{
"request": {
"application": "APPLICATION_CODE", // Pushwoosh application code
"hwid": "HWID", // hardware device ID used in /registerDevice function call
"lat": 10.12345, // latitude of the device
"lng": 28.12345 // longitude of the device
}
}
<?php
//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 'Oups, the operation failed :-(';
print 'Status code : ' . $response->getStatusCode();
print 'Status message : ' . $response->getStatusMessage();
}

post
/addGeoZone

https://cp.pushwoosh.com/json/1.3/addGeoZone
Adds a Geozone to a particular app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
geozones
required
array
Geozone parameters. Can be a JSON array. See details in a request example below.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"GeoZones": [550] //geozone ids
}
}
Example
{
"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 array, required is 'presetCode' field is empty.
"presetCode": "AAAAA-BBBBB", // optional. Push preset could be used instead of content field. Note: REQUIRED if content field is empty
"cluster": "GEOZONE CLUSTER CODE", // optional. Specify null to unbind cluster from GeoZone
"campaign": "CAMPAIGN_CODE", // optional. Specify null to unbind Campaign from GeoZone. If omit then Campaign value will not be changed. Has higher priority than Campaign from preset
"timetable": { // optional
"timezone": 1234, // in seconds
"Mon": [ // available days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. Push sending stopped for missing day in list
{
"start": "04:11",
"stop": "12:00"
}
],
"Sun": [
{ // one or two intervals
"start": "01:11",
"stop": "17:00"
},
{
"start": "18:01",
"stop": "23:59"
}
]
}
}]
}
}

post
/updateGeoZone

https://cp.pushwoosh.com/json/1.3/updateGeoZone
Updates Geozone properties.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
geoZoneId
required
string
Geozone ID from /addGeoZone request.
name
optional
string
New Geozone name.
cooldown
optional
integer
Cooldown to update, in seconds.
status
optional
integer
0 - deactivated, 1 - activated.
content
optional
string
Content for Geozone push notification. Cannot be used with presetCode.
cluster
optional
string
New cluster name. Specify 'null' to unbind cluster from Geozone.
campaign
optional
string
New campaign ID. Specify 'null' to unbind Campaign from Geozone. If omitted, Campaign value won't be changed. Has higher priotiy than a Campaign from a preset.
lat
optional
number
Geozone latitude.
lng
optional
number
Geozone longitude.
range
optional
integer
New range in meters.
timetable
optional
object
Geozone timetable. See more info below.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": null
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"geoZoneId": 100016750, // from /addGeoZone method
"name": "new geozone name",
"cooldown": 222, // in seconds
"status": 0, // 0 - deactivated, 1 - activated
"presetCode": "BBBBB-AAAAA", // cannot be used along with "content"
"content": "new geozone content", // cannot be used along with "presetCode"
"cluster": "GEOZONE CLUSTER CODE", // Specify null to unbind cluster from GeoZone
"campaign": "CAMPAIGN_CODE", // Specify null to unbind Campaign from GeoZone. If omit then Campaign value will not be changed. Has higher priority than Campaign from preset
"lat" : 10.56, //geozone latitude
"lng" : 12.523,//geozone longitude
"range" : 500, ////geozone range
"timetable": {
"timezone": 1234, // in seconds
"Mon": [ // available days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. Push sending stopped for missing day in list
{
"start": "04:11",
"stop": "12:00"
}
],
"Sun": [
{ // one or two intervals
"start": "01:11",
"stop": "17:00"
},
{
"start": "18:01",
"stop": "23:59"
}
]
}
}
}

post
/deleteGeoZone

https://cp.pushwoosh.com/json/1.3/deleteGeoZone
Removes Geozones from the app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
geozones
required
string
Array of IDs or a single ID of a Geozone to remove.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": null
}

For Private Offering subscriptions only.

{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX", // Pushwoosh application code
"geozones": [550,526] // geozones IDs
}
}

post
/addGeoZoneCluster

https://cp.pushwoosh.com/json/1.3/addGeoZoneCluster
Adds Geozone Cluster to the app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
name
required
string
Cluster name.
cooldown
optional
integer
A delay before a single user can receive the same message from the Geozone Cluster, in seconds.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"GeoZoneCluster": "EA1CE-69405" //geozone cluster id
}
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX", // Pushwoosh application code
"name": "Raccoon city", // cluster name
"cooldown": 3210 // in seconds
}
}

post
/deleteGeoZoneCluster

https://cp.pushwoosh.com/json/1.3/deleteGeoZoneCluster
Removes a Geozone Cluster from the app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
geoZoneCluster
required
string
ID of the Geozone cluster to remove.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": null
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX", // Pushwoosh application code
"geoZoneCluster": "EA1CE-69405" // cluster ID
}
}

post
/listGeoZones

https://cp.pushwoosh.com/json/1.3/listGeoZones
Retrieves a list of Geozones for the app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"clusters": [
{
"name": "Geozones without Cluster",
"geoZones": [
{
"id": 17528,
"name": "Statue of George",
"lat": 40.70088,
"lng": -73.93185,
"cooldown": 60,
"range": 50,
"presetCode": null,
"content": {
"default": "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
},
"status": true,
"campaign_id": 0,
"timetable": null
}
]
}
]
}
}

For Private Offering subscriptions only.

Example
{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX" // Pushwoosh application code
}
}

post
/listGeoZoneClusters

https://cp.pushwoosh.com/json/1.3/listGeoZoneClusters
Retrieves a list of Geozone clusters for the app.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"clusters": [
{
"code": "AE2C4-4E070",
"cooldown": 86400,
"geozones": 1,
"name": "Cluster on Times"
},
{
"code": "4F244-17CDD",
"cooldown": 86400,
"geozones": 1,
"name": "Cluster on Union"
}
]
}
}

For Private Offering subscriptions only.

Example
{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX" // Pushwoosh application code
}
}