User Centric API

API methods to manage users

post
/registerUser

https://cp.pushwoosh.com/json/1.3/registerUser
Associates external User ID with a specified device.
Request
Response
Request
Body Parameters
userId
required
string
User ID to associate with a device. If empty, use hwid.
application
required
string
Pushwoosh application code.
hwid
required
string
Pushwoosh HWID
tz_offset
optional
integer
Timezone offset in seconds for the device.
device_type
required
integer
Device type. See possible values in /registerDevice.
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response":null
}

Can be used later in /createMessage API call (the users parameter). This is normal to call this function before you have the push token and before /registerDevice call.

Example
{
"request": {
"userId": "user_3078a", // type: string. If empty, use hwid
"application": "XXXXX-XXXXX", // Pushwoosh application code
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // Hardware device ID
"tz_offset": -2917, // Timezone offset
"device_type": 3 // device platform, possible values: 1 — iOS; 2 — BB; 3 — Android; 5 — Windows Phone; 7 — OS X; 8 — Windows 8; 9 — Amazon; 10 — Safari; 11 — Chrome; 12 — Firefox; 13 - IE11, 17 - Huawei
}
}

For emails, call /registerEmailUser.

post
/postEvent

https://cp.pushwoosh.com/json/1.3/postEvent
Calls the event within the app.
Request
Response
Request
Body Parameters
hwid
optional
string
Hardware device ID used in a /registerDevice request. Can be replaced with userId to identify a user who has triggered an event.
application
required
string
Pushwoosh application code.
event
required
string
Event name exactly as created in Pushwoosh Control Panel.
attributes
optional
object
JSON object with the event attributes.
timestampUTC
optional
integer
Timestamp in UTC.
timestampCurrent
optional
integer
Timestamp in local time.
userId
required
string
User ID associated with a user who has triggered the event. Can be used instead of or together with an HWID.
device_type
required
integer
See possible values in /registerDevice method.
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"code": "61BC9-84DD0"
}
}

The event's name in the request must match the event name in Pushwoosh Control Panel. Note that "attributes" property may be empty (but not omitted) in case the event has no attributes.

Example
{
"request":{
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // Optional. Hardware device ID used in a /registerDevice request. Can be used together with an userId to identify a user who has triggered an event.
"application": "XXXXX-XXXXX", // Pushwoosh application code
"event": "activityCompleted", // event name exactly as created in Pushwoosh Control Panel
"attributes": {
"login": "facebook",
"success": "yes",
"internet": "wifi",
...
},
"timestampUTC": 1435228403, // timestamp in UTC
"timestampCurrent": 1435253603, // timestamp in local time
"userId": "someuser@user.com", // Required. a user id which is used for identification of users on multiple devices. Can be used instead of or together with an HWID.
"device_type": 1 // device platform, possible values: 1 — iOS; 2 — BB; 3 — Android; 5 — Windows Phone; 7 — OS X; 8 — Windows 8; 9 — Amazon; 10 — Safari; 11 — Chrome; 12 — Firefox; 13 - IE11; 17 - Huawei
}
}

post
/getUsersDetails

https://cp.pushwoosh.com/json/1.3/getUsersDetails
Returns mapped devices and tag data for a specified userID.
Request
Response
Request
Body Parameters
auth
required
string
API access token from Pushwoosh Control Panel.
application
required
string
Pushwoosh application code.
userIds
required
array
IDs of the users to get info for.
Response
200: OK
{
"status_code": 200,
"status_message": "OK",
"response": {
"request_id": "12348b2aa4162fb478bd1fb5fcbb1254"
}
}

For Private Offering subscriptions only.

Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
"application": "XXXXX-XXXXX", // Pushwoosh application code
"userIds": ["user_id321"]
}
}

Like every scheduled request, /getUsersDetails requires an additional /getResults request.

Response body:

Field

Type

Description

request_id

string

Scheduled request ID. Please check /getResults method for more info.

Scheduled (/getResults) response:

Example
{
"status_code": 200,
"status_message": "OK",
"response": {
"devices": [
{
"applicationCode": "APPLICATION_CODE",
"hwid": "HWID",
"pushToken": "PUSH_TOKEN",
"type": 3,
"tzOffset": 0,
"tags": "{\"First Install\":\"2017-07-25\"}",
"badges": 0,
"androidPackages": "[]",
"latitude": null,
"longitude": null,
"publicKey": "",
"authToken": "",
"userId": "myuser_id321"
}
]
}
}