Filters

API methods to manage Filters

post
/createFilter

https://cp.pushwoosh.com/json/1.3/createFilter
Creates a new filter.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
name
required
string
Filter name.
conditions
optional
array
Filter conditions. Conditions syntax is explained in /createMessage.
operator
optional
string
Operator values: 'AND', 'OR'.
application
optional
string
Pushwoosh application code. This parameter is usable only with High-Speed Setup; omit otherwise.
expiration_date
optional
string
Filter expiry. The filter will be automatically deleted on a date specified, unless it's used in a Preset or an RSS Feed.
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"name": "filter name"
}
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"name": "filter name",
"conditions": [["TagName1", "IN", ["value1", "value2"]], ["TagName2", "IN", ["value1", "value2"]]], // optional. Filter conditions
"operator": "AND", // operator values: 'AND', 'OR'
"application": "AAAAA-00000", // this parameter is usable only with High-Speed setup; omit otherwise
"expiration_date": "2018-12-31" // Filter expiry. The filter will be automatically deleted on date specified, unless it's used in a Push Preset or an RSS feed
}
}
// creating Filters for Timezones
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"name": "timezone name",
"conditions": [["Timezone", "BETWEEN", ["UTC-12:00", "UTC+14:00"]]],
}
}

post
/listFilters

https://cp.pushwoosh.com/json/1.3/listFilters
Returns a list of available filters with their conditions.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"filters": [
{
"name": "filter name",
"conditions": "#TagName1(value1, value2) AND #TagName2(value1, value2)",
"application" : "AAAAA-ZZZZZ", //only for app-specific filters
"expiration_date": "YYYY-MM-DD", //"null" for filters without expiration date
"application" : "AAAAA-ZZZZZ" // only for app-specific filters
}
]
}
}

For Private Offering subscriptions only.

Example
{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H" // API access token from Pushwoosh Control Panel
}
}

post
/deleteFilter

https://cp.pushwoosh.com/json/1.3/deleteFilter
Deletes an existing filter.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
name
required
string
Filter name.
Response
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
"name": "filter name"
}
}

post
/exportSegment

https://cp.pushwoosh.com/json/1.3/exportSegment
A scheduled request. Exports the list of subscribers that fall under specified Filter conditions.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
devices_filter
required
string
Filter conditions
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"request_id": "b3337d8ec78f67280a40a5b89050c0c0"
}
}

For Private Offering subscriptions only.

Example
{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"devices_filter": "T(\"Language\", EQ, \"ru\")" // filter conditions.
}
}

Please find Filter conditions syntax reference here.

To export all subscribers of a particular app, use the following Filter conditions:

{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"devices_filter": "A(\"AAAAA-BBBBB\")" // Pushwoosh app code
}
}

Like every scheduled request, /exportSegment request requires an additional /getResults request

Response body:

Field

Type

Description

request_id

string

Scheduled request Id. Please check/getResults method for more information

Scheduled (/getResults) response:

Example success response
Example error response
Example success response
{
"status_code": 200,
"status_message": "OK",
"response": {
"devices_count": 50,
"public_url" : "https://static.pushwoosh.com/segment-export/segment.zip"
}
}
Example error response
{
"status_code":210,
"status_message":"Errors occured while compiling filter",
"response":{
"errors":[
{
"message":"Numeric or string constant expected.",
"type":"syntax",
"near":"en"
}
]
}
}

Go to the link from the "public_url" parameter of the response to the /getResults request. A ZIP archive will be downloaded automatically. Unpack the archive to get the CSV file with the devices' data.

The CSV file contains the following data:

Field

Description

Example of value

Hwid

Hardware ID of a device

01D1BA5C-AAAA-0000-BBBB-9B81CD5823C8

User ID

User ID associating a device with a particular user. If no User ID assigned, the HWID is used.

user8192

Push Token

Unique identifier assigned to a device by cloud messaging gateways.

eeeb2fd7....0fc3547

Type

Platform type (integer).

1

Type (humanized)

Platform type (string).

iOS

Age

Value of the default Age tag.

29

ApplicationVersion

Value of the default Application Version tag.

1.12.0.0

City

Value of the default City tag.

us, boston

TagName

Value of a tag created in your account.

TagValue