Device API

registerDevice

post
https://cp.pushwoosh.com/json/1.3
/registerDevice
/registerDevice
Example
1
{
2
"request":{
3
"application": "XXXXX-XXXXX", // Pushwoosh application code
4
"push_token": "dec301908b9ba8df85e57a58e40f96f523f4c2068674f5fe2ba25cdc250a2a41",
5
"hwid": "1CA68A12-8DAC-4BB7-BEE5-B756288B6D3C", // hardware device ID
6
"idfa" : "AEBE52E7-03EE-455A-B3C4-E57283966239", // optional
7
"timezone": 3600, // offset in seconds
8
"device_type": 1,
9
"language": "en", // ISO 639-1|639-2 language code
10
"userId": "Alex", // optional
11
12
// system tags, optionals
13
"app_version": "1.2.3",
14
"device_model": "Samsung SM-G355H",
15
"jailbroken": "1", // 1 or 0
16
"os_version": "2.3",
17
18
// optional encryption keys for chrome/firefox
19
"public_key": "BNmDO4BTKEMJqaqprTf7t/HBUd2BQ/orc88cc/scS5CFP6zhQGIHI1/GgRQD8c4kTxTEEF0quvIUiLQqoBY0/Qo=",
20
"auth_token": "RlRmCCdGM/s7ouuhjKFzoQ==",
21
22
//optional FCM keys for Chrome (for XMPP)
23
"fcm_token": "BNmDO4BTKEMJqaqprTf7t/HBUd2BQ/orc88cc/scS5CFP6zhQGIHI1/GgRQD8c4kTxTEEF0quvIUiLQqoBY0/Qo=",
24
"fcm_push_set": "RlRmCCdGM/s7ouuhjKFzoQ=="
25
}
26
}
Copied!
Possible device types:
  • 1 – iOS
  • 3 – Android
  • 5 – Windows Phone
  • 7 – OS X
  • 8 – Windows 8
  • 9 – Amazon
  • 10 – Safari
  • 11 – Chrome
  • 12 – Firefox
For emails call /registerEmail.
Status codes:
HTTP Status code
status_code
Description
200
200
Device successfully registered
200
210
Argument error. See status_message for more info.
400
N/A
Malformed request string
500
500
Internal error
PHP
1
<?php
2
//see http://gomoob.github.io/php-pushwoosh/register-device.html
3
use Gomoob\Pushwoosh\Model\Request\RegisterDeviceRequest;
4
5
// creates request instance
6
$request = RegisterDeviceRequest::create()
7
->setDeviceType(DeviceType::1())
8
->setHwid('HWID')
9
->setLanguage('fr')
10
->setPushToken('xxxxxxxx')
11
->setTimezone(3600);
12
13
// call '/registerDevice' Web Service
14
$response = $pushwoosh->registerDevice($request);
15
16
if($response->isOk()) {
17
print 'Ok, operation successful.';
18
} else {
19
print 'Oups, the operation failed :-(';
20
print 'Status code : ' . $response->getStatusCode();
21
print 'Status message : ' . $response->getStatusMessage();
22
}
Copied!

unregisterDevice

post
https://cp.pushwoosh.com/json/1.3
/unregisterDevice
/unregisterDevice
Example
1
{
2
"request":{
3
"application": "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2" // hardware device ID used in /registerDevice function call
5
}
6
}
7
8
Copied!
For emails call /deleteEmail.
Status codes:
HTTP Status code
status_code
Description
200
200
Device successfully unsubscribed
200
210
Argument error. See status_message for more info.
400
N/A
Malformed request string
500
500
Internal error
PHP
1
<?php
2
// see http://gomoob.github.io/php-pushwoosh/unregister-device.html
3
use Gomoob\Pushwoosh\Model\Request\UnregisterDeviceRequest;
4
5
// creates request instance
6
$request = UnregisterDeviceRequest::create()->setHwid('HWID');
7
8
// call '/unregisterDevice' Web Service
9
$response = $pushwoosh->unregisterDevice($request);
10
11
if($response->isOk()) {
12
print 'Ok, operation successful.';
13
} else {
14
print 'Oups, the operation failed :-(';
15
print 'Status code : ' . $response->getStatusCode();
16
print 'Status message : ' . $response->getStatusMessage();
17
}
Copied!

checkDevice

post
https://cp.pushwoosh.com/json/1.3
/checkDevice
/checkDevice
Example
1
{
2
"request": {
3
"application": "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "hardware-device-id"
5
}
6
}
Copied!

setTags

post
https://cp.pushwoosh.com/json/1.3
/setTags
/setTags
The method is called from the 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.
Example
1
{
2
"request":{
3
"application": "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // hardware device ID used in /registerDevice function call
5
"tags": {
6
"StringTag": "string value",
7
"IntegerTag": 42,
8
"ListTag": ["string1","string2"], // sets the list of values for Tags of List type
9
"DateTag": "2015-10-02 22:11", // note the time is in UTC
10
"BooleanTag": true, // valid values are - true, 1, false, 0, null
11
}
12
}
13
}
Copied!

Append List tag values

To extend the List Tag with new values, use the operation parameter with the "append" value as follows:
Example
1
{
2
"request": {
3
"hwid": "3d124a793575f189a5ca7dfd96e8aafd", // hardware device ID used in /registerDevice function call
4
"application": "61A79-C09B3", // Pushwoosh application code
5
"tags": {
6
"ListTag": {
7
"operation": "append", // appends following values to the Tag's list of values
8
"value": [ // values to append
9
"tag2",
10
"tag3"
11
]
12
}
13
}
14
}
15
}
Copied!

Set tags by UserID

To set tags for all devices associated to a particular User ID, use the "userId" parameter instead of "hwid".
Make sure the tag you're setting values for is user-specific.
Example
1
{
2
"request":{
3
"application": "AAAAA-BBBBB", // Pushwoosh app code
4
"userId": "some_user", // user ID you'd like to set tags for
5
"tags": { // tags and values to set
6
"Language": "es"
7
8
}
9
}
10
}
Copied!
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
1
<?php
2
//see http://gomoob.github.io/php-pushwoosh/set-tags.html
3
use Gomoob\Pushwoosh\Model\Request\SetTagsRequest;
4
5
// Creates the request instance
6
$request = SetTagsRequest::create()
7
->setTags(
8
array(
9
'StringTag' => 'string value',
10
'IntegerTag' => 'integer value',
11
'ListTag' => ['string1', 'string2']
12
)
13
)
14
->setHwid('HWID');
15
16
// Call the '/setTags' Web Service
17
$response = $pushwoosh->setTags($request);
18
19
if($response->isOk()) {
20
print 'Ok, operation successful.';
21
} else {
22
print 'Oups, the operation failed :-(';
23
print 'Status code : ' . $response->getStatusCode();
24
print 'Status message : ' . $response->getStatusMessage();
25
}
26
Copied!

setBadge

post
https://cp.pushwoosh.com/json/1.3
/setBadge
/setBadge
Example
1
{
2
"request":{
3
"application" : "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // hardware device ID used in /registerDevice function call
5
"badge": 4 // current badge on the application
6
}
7
}
Copied!
Called from the SDK internally. Sends current badge value for a device to Pushwoosh. This happens internally when app changes badge value on iOS device. Allows auto-incrementing badges to work properly.
This method IS NOT used to update the badge value on the device. Instead please use /createMessage request with the "ios_badges" parameter.
PHP
1
<?php
2
//see http://gomoob.github.io/php-pushwoosh/set-badge.html
3
use Gomoob\Pushwoosh\Model\Request\SetBadgeRequest;
4
5
// Creates the request instance
6
$request = RegisterDeviceRequest::create()
7
->setBadge(5)
8
->setHwid('HWID');
9
10
// Call the '/setBadge' Web Service
11
$response = $pushwoosh->setBadge($request);
12
13
if($response->isOk()) {
14
print 'Ok, operation successful.';
15
} else {
16
print 'Oups, the operation failed :-(';
17
print 'Status code : ' . $response->getStatusCode();
18
print 'Status message : ' . $response->getStatusMessage();
19
}
Copied!

applicationOpen

post
https://cp.pushwoosh.com/json/1.3
/applicationOpen
/applicationOpen
Example
1
{
2
"request":{
3
"application" : "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2" // hardware device ID used in /registerDevice function call
5
}
6
}
Copied!

pushStat

post
https://cp.pushwoosh.com/json/1.3
/pushStat
/pushStat
Example
1
{
2
"request":{
3
"application" : "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // hardware device ID used in /registerDevice function call
5
"userId": "USER012345", // the user id to associate with the push open event
6
"hash": "HASH_TAG" // hash tag received in push notification (“p” parameter in the push payload)
7
}
8
}
Copied!
PHP
1
<?php
2
//see http://gomoob.github.io/php-pushwoosh/push-stat.html
3
use Gomoob\Pushwoosh\Model\Request\PushStatRequest;
4
5
// Creates the request instance
6
$request = PushStatRequest::create()
7
->setHash('hash')
8
->setHwid('HWID');
9
10
// Call the '/pushStat' Web Service
11
$response = $pushwoosh->pushStat($request);
12
13
if($response->isOk()) {
14
print 'Ok, operation successful.';
15
} else {
16
print 'Oups, the operation failed :-(';
17
print 'Status code : ' . $response->getStatusCode();
18
print 'Status message : ' . $response->getStatusMessage();
19
}
Copied!

messageDeliveryEvent

post
https://cp.pushwoosh.com/json/1.3
/messageDeliveryEvent
/messageDeliveryEvent
Example
1
{
2
"request":{
3
"application" : "XXXXX-XXXXX", // Pushwoosh application code
4
"hwid": "8f65b16df378e7a6bece9614e1530fb2", // hardware device ID used in /registerDevice function call
5
"hash": "HASH_TAG" // hash tag received in push notification (“p” parameter in the push payload)
6
}
7
}
Copied!

setPurchase

post
https://cp.pushwoosh.com/json/1.3
/setPurchase
/setPurchase
Example
1
{
2
"request":{
3
"transactionDate": "2014-10-30T10:55:14Z", // date of the transaction
4
"application": "XXXXX-XXXXX", // Pushwoosh application code
5
"hwid": "F6BA94A2-6BB2-XXXX-XXXX-E945C686240D", // hardware device ID used in /registerDevice function call
6
"quantity": 1, // items quantity
7
"currency": "USD", // transaction currency
8
"productIdentifier": "com.pushon.purchase.1", // product SKU
9
"price": 0.99 // item price
10
}
11
}
Copied!

deleteDevice

post
https://cp.pushwoosh.com/json/1.3
/deleteDevice
/deleteDevice
Example
1
{
2
"request": {
3
"application":"XXXXX-XXXXX", // Pushwoosh app code
4
"hwid": "hardware-device-id"
5
}
6
}
7
Copied!
Last modified 1mo ago