Tags API

API methods to manage Tags

To set tag values for HWIDs and UserIDs, use the /setTags method from Device API.

addTag

/addTag

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

Request Body

{
    "status_code": 200,
    "status_message": "OK",
    "response": {
        "result": true
    }
}

Creates a tag in your account.

For Custom Plan subscriptions only. For more details, please contact our Sales team.

Example
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H", // required, API access token from Pushwoosh Control Panel
    "tag": {
      "name": "TAG_NAME", // required
      "type": 1, // required, see possible values below   
      "application_specific": true, // or 'false', optional. Defines whether the tag value should be different for multiple apps or be the same across multiple apps
      "user_specific": true // or 'false', optional, 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"

deleteTag

/deleteTag

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

Request Body

{
    "status_code": 200,
    "status_message": "OK",
    "response": {
        "result": true
    }
}

Completely removes a tag with all the associated information from the database.

For Custom Plan subscriptions only. For more details, please contact our Sales team.

Example
{
  "request": {

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

listTags

/listTags

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

Request Body

{
 "status_code":200,
 "status_message":"OK",
 "response":{
 "tags":[
         {
           "name":"Language",
           "type":2,
           "isApplicationSpecific": false
         },
         {
           "name":"List tag",
           "type":3,
           "isApplicationSpecific": false
         }
    ]
 }
}

Retrieves a list of tags on the account.

For Custom Plan subscriptions only. For more details, please contact our Sales team.

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"

getTags

/getTags

POST https://go.pushwoosh.com/json/1.3/getTags

Request Body

{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "result": {
      "Language": "fr"
    }
  }
}

Retrieves a list of tags with corresponding values for the specific device.

Example
{
   "request":{
      "application": "XXXXX-XXXXX", // required, 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
   }
}

bulkSetTags

/bulkSetTags

POST https://api.pushwoosh.com/api/v2/audience/bulkSetTags

Request Body

{
    request_id : "request_id to use in GET method to obtain job status",
    "status" : "Pending"
}

Sets tag values for the list of devices.

Request:
{
    "application" : "application code", // required, Pushwoosh app code
    "auth" : "Pushwoosh auth token", // required, API access token from Pushwoosh Control Panel
    "create_missing_tags" : false,          // optional, should automatically create missing tags
    "devices" : [{                          // required, array of devices
        "hwid" : "device hwid",             // optional, can be used to identify a device instead of "user_id" or "push_token".
        "user_id" : "user ID",              // optional, can be used to identify a user instead of "hwid" or "push_token".
        "push_token" : "device push token", // optional, can be used to identify a device instead of "hwid" or "user_id".
        "list_operator" : "set",            // required for list tags. Defines how to set values for tags of the list type: set, append, or remove
        "tags" : { // required. Values to set for the tags specified. 
            "tag_name" : "tagvalue",        // use correct value type
            "tag_name2" : "tagvalue2"
        }
    }]
}
Response:
{
    "request_id" : "request_id to use in GET method to obtain job status",
    "status" : "Pending"
}

/bulkSetTags status

GET https://api.pushwoosh.com/api/v2/audience/bulkSetTags/{request_id}?detailed=false

Path Parameters

Query Parameters

Returns the status of /bulkSetTags operation

Response:
{
    "request_id": "id of the request",
    "status": "Completed",          // also "Pending", "Failed"
    "progress": 100,                // jobs progress 0-100
    "devices_success": 100,         // good devices
    "devices_not_found": 0,         // devices not found in Pushwoosh
    "devices_failed": 0,            // errored
    "devices": [                    // device report (only in detailed = true)
        {
            "hwid": "device hwid",
            "status": "done",       // also "failed", "not found"
            "tags": {
                "tagName": "ok",
                "tagName2": "tag not found",
                "tagName3": "wrong value. expect :string",
            }
        }
    ]
}

Last updated