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
Request
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.
Response
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
Request
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.
Response
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
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
Response
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
/getTags

https://cp.pushwoosh.com/json/1.3/getTags
Retrieves a list of tags with corresponding values for the specific device.
Request
Response
Request
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.
Response
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
/setTags

https://cp.pushwoosh.com/json/1.3/setTags
Sets tag values for the device. Called from the SDK.
Request
Response
Request
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.
Response
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"], // sets the list of values for Tags of List type
"DateTag": "2015-10-02 22:11", // note the time is in UTC
"BooleanTag": true, // valid values are - true, 1, false, 0, null
}
}
}

To extend the List Tag with new values, use the operation parameter with the "append" value as follows:

Example
{
"request": {
"hwid": "3d124a793575f189a5ca7dfd96e8aafd", // hardware device ID used in /registerDevice function call
"application": "61A79-C09B3", // Pushwoosh application code
"tags": {
"ListTag": {
"operation": "append", // appends following values to the Tag's list of values
"value": [ // values to append
"tag2",
"tag3"
]
}
}
}
}

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

https://cp.pushwoosh.com/json/1.3/bulkSetTags
Sets tag values for the list of devices.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh app code.
devices
required
array
An array of JSON objects. See the example request for the details. Max 1000 devices.
Response
200: OK
OK
Error
OK
{
"response":"None",
"status_code":200,
"status_message":"OK"
}
Error
{
"message": "invalid request",
"errors": [
"tags [TagName] not found"
]
}
Example
{
"request":{
"application": "AAAAA-BBBBB", // Pushwoosh app code
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"devices":[
{
"hwid":"15fbe9125b1b0c07b9315703", // hardware ID of a device
"tags":{ // tags to set values for
"Age":18, // tag name and value
"Name":"Anna"
}
},
{
"hwid":"ba08e11ea6485d867",
"tags":{
"Age":19,
"Name":"Kevin"
}
}
]
}
}

The maximum number of devices in a single request is 1000.