Skip to content

Geozones API

getNearestZone

Called internally from the SDK. Retrieves the parameters of the nearest geozone and the distance to it. Also records the device location for geo push notifications.

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

Request parameters

ParameterTypeRequiredDescription
applicationstringYesPushwoosh application code.
hwidstringYesHardware device ID used in the /registerDevice request.
latstringYesLatitude of the device.
lngstringYesLongitude of the device.

Request example

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

PHP Example

// 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

Adds a Geozone to a specific app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.
geozonesarrayYesGeozone parameters as a JSON array.
geozones.namestringYesGeozone name.
geozones.latstringYesGeozone latitude.
geozones.lngstringYesGeozone longitude.
geozones.cooldownintegerYesSilent period after sending a notification (in seconds).
geozones.rangeintegerYesGeozone range (in meters, from 50 to 1000).
geozones.contentstring or objectRequired if presetCode is empty.Geozone message content.
geozones.presetCodestringRequired if content is empty.Push preset to use instead of content.
geozones.clusterstringNoSpecify null to unbind a cluster from the Geozone.
geozones.campaignstringNoSpecify null to unbind a campaign from the Geozone. If omitted, the campaign value remains unchanged. Note: Has higher priority than the campaign in the preset.
geozones.timetableobjectNoSets timetable intervals.

Request 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 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

Updates Geozone properties.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
geoZoneIdstringYesGeozone ID from /addGeoZone request.
namestringNoNew Geozone name.
cooldownintegerNoCooldown to update, in seconds.
statusintegerNo0 - deactivated, 1 - activated.
contentstringNoContent for Geozone push notification. Cannot be used with presetCode.
clusterstringNoNew cluster name. Specify null to unbind cluster from Geozone.
campaignstringNoNew campaign ID. Specify null to unbind Campaign from Geozone. If omitted, Campaign value won’t be changed. Has higher priority than a Campaign from a preset.
latnumberNoGeozone latitude.
lngnumberNoGeozone longitude.
rangeintegerNoNew range in meters.
timetableobjectNoGeozone timetable. See more info below.

Request example

{
"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

Removes Geozones from the app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.
geozonesstringYesArray of IDs or a single ID of a Geozone to remove.

Request example

{
"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

Adds Geozone Cluster to the app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.
namestringYesCluster name.
cooldownintegerYesA delay before a single user can receive the same message from the Geozone Cluster, in seconds.

Request example

{
"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

Removes a Geozone Cluster from the app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.
geoZoneClusterstringYesID of the Geozone cluster to remove.

Request example

{
"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

Retrieves a list of Geozones for the app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.

Request example

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

listGeoZoneClusters

Retrieves a list of Geozone clusters for the app.

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

Request parameters

Parameter
Type
RequiredDescription
authstringYesAPI access token from Pushwoosh Control Panel.
applicationstringYesPushwoosh application code.

Request example

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