Tags

API methods to manage Tags

post
/addTag

https://cp.pushwoosh.com/json/1.3/addTag
Creates a new tag in the database.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
tag
required
object
Tag parameters.
tag.name
required
string
Tag name.
tag.type
required
integer
Tag type. See possible values below.
tag.application_specific
optional
boolean
Defines whether the tag value should be different for multiple apps or be the same across multiple apps.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"result": true
}
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"tag": {
"name": "TAG_NAME",
"type": 1, // see possible values below
"application_specific": true, // or 'false'. Defines whether the tag value should be different for multiple apps or be the same across multiple apps
"user_specific": true // or 'false', used for application_specific tags
}
}
}

Possible tag value types:

  • 1 - Integer

  • 2 - String

  • 3 - List

  • 4 - Date

  • 5 - Boolean

  • 6 - Decimal. Ex: 19.95

  • 7 - Version. Ex: "1.0.0.0"

post
/deleteTag

https://cp.pushwoosh.com/json/1.3/deleteTag
Completely removes a tag with all the associated information from the database.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
tag
required
object
Tag parameters.
tag.name
required
string
Name of a tag to delete.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"result": true
}
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"tag": {
"name": "TAG_NAME" // name of a tag to delete
}
}
}

post
/listTags

https://cp.pushwoosh.com/json/1.3/listTags
Retrieves a list of tags on the account.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
200: OK
{
"status_code":200,
"status_message":"OK",
"response":{
"tags":[
{
"name":"Language",
"type":2,
"isApplicationSpecific": false
},
{
"name":"List tag",
"type":3,
"isApplicationSpecific": false
}
]
}
}

For Private Offering subscriptions only.

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

Tag types:

  • 1 - Integer

  • 2 - String

  • 3 - List

  • 4 - Date

  • 5 - Boolean

  • 6 - Decimal. Ex: 19.95

  • 7 - Version. Ex: "1.0.0.0"

post
/setTags

https://cp.pushwoosh.com/json/1.3/setTags
Sets tag values for the device. Called from the SDK.
Request
Response
Body Parameters
application
required
string
Pushwoosh application code.
hwid
required
string
Hardware device ID used in /registerDevice request.
tags
required
object
JSON object of tags to set, send 'null' to remove the value.
200: OK
{
"status_code":200,
"status_message":"OK",
"response": null
}

The method is called from SDK. It is possible to call it remotely from your backend, however you need to maintain an up-to-date database of hwid’s on the backend side.

Please avoid setting more that 50 tag values in a single /setTags request.

Example
{
"request":{
"application": "XXXXX-XXXXX", // Pushwoosh application code
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // hardware device ID used in /registerDevice function call
"tags": {
"StringTag": "string value",
"IntegerTag": 42,
"ListTag": ["string1","string2"],
"DateTag": "2015-10-02 22:11", //note the time is in UTC
"BooleanTag": true, // valid values are - true, 1, false, 0, null
}
}
}

For emails call /setEmailTags.

Status codes:

HTTP Status code

status_code

Description

200

200

Tags have been successfully set

200

210

Argument error. See status_message for more info.

400

N/A

Malformed request string

500

500

Internal error

PHP
<?php
//see http://gomoob.github.io/php-pushwoosh/set-tags.html
use Gomoob\Pushwoosh\Model\Request\SetTagsRequest;
// Creates the request instance
$request = SetTagsRequest::create()
->setTags(
array(
'StringTag' => 'string value',
'IntegerTag' => 'integer value',
'ListTag' => ['string1', 'string2']
)
)
->setHwid('HWID');
// Call the '/setTags' Web Service
$response = $pushwoosh->setTags($request);
if($response->isOk()) {
print 'Ok, operation successful.';
} else {
print 'Oups, the operation failed :-(';
print 'Status code : ' . $response->getStatusCode();
print 'Status message : ' . $response->getStatusMessage();
}

post
/getTags

https://cp.pushwoosh.com/json/1.3/getTags
Retrieves a list of tags with corresponding values for the specific device.
Request
Response
Body Parameters
application
required
string
Pushwoosh application code.
userId
optional
string
User identifier to be used instead of "hwid". If used together with a "hwid", the "hwid" prevails.
hwid
optional
string
Hardware device ID used in /registerDevice request.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"result": {
"Language": "fr"
}
}
}
Example
{
"request":{
"application": "XXXXX-XXXXX", // Pushwoosh application code
"hwid": "HWID", // optional, hardware device ID used in /registerDevice function call
"userId": "The ID of a specific user" // optional, can be used instead of "hwid" to retrieve tags for a specific user
}
}

post
/getTagStats

https://cp.pushwoosh.com/json/1.3/getTagStats
Displays statistics for the specified Tag.
Request
Response
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
tag
required
string
Tag name.
applications
optional
array
List of applications. Specify only when the tag is application-specific.
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"request_id": "2702dd59b826e4a23b2f1af24de53108" //request_id for /getResults method
}
}

For Private Offering subscriptions only.

Example
{
"request":{
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"tag": "TAG_NAME",
"applications": ["APPLICATION_1", "APPLICATION_2", "APPLICATION_3"] // optional. Specify only when the tag is app specific
}
}

As every scheduled request, getTagStats request requires an additional /getResults request.

/getResults response:

{
"status_code": 200,
"status_message": "OK",
"response": {
"fileName": "DIRECT_FILE_URL.csv" // direct link to the csv file
}
}

Received file is a csv file with a semicolon ";" separator.

csv file content example:

13C2B-72C62;ua_settingpushbod;3
13C2B-72C62;ua_settingpushhealth;3
13C2B-72C62;ua_settingpushstrength;3
13C2B-72C62;ua_settingpushupdate;2