Register a recipient (v2)

Purpose

Associates a recipient with a device token.
You should call this method every time you request a token from the device, which basically means on every startup. It does not matter if the recipient exists or not. We will create one if not or update if needed.

URL

Sandbox

https://sandbox.httpush.com/ACCOUNT_KEY/v2/recipient/registration.json
https://sandbox.httpush.com/ACCOUNT_KEY/v2/recipient/registration.xml

Production

https://production.httpush.com/ACCOUNT_KEY/v2/recipient/registration.json
https://production.httpush.com/ACCOUNT_KEY/v2/recipient/registration.xml

Find your ACCOUNT_KEY on the dashboard at the management web site.

HTTP Method

POST

Formats

JSON, XML

Requires Authentication

Yes (about Authentication)

Parameters

Send the parameters as either JSON or XML data as the body of your request.

Usage Notes

recipient_key should be URL encoded.

Example Data

Example JSON data

{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "t": "bd0d796c80c2c5a972bf01f27397e209f3916edc25436e422281b9fa2d60df40", "r": "test"}

Example XML data

<?xml version="1.0" encoding="UTF-8"?>
<register>
  <a>05673b6d12c796afc0cb74849e60573949bf2521</a>
  <t>bd0d796c80c2c5a972bf01f27397e209f3916edc25436e422281b9fa2d60df40</t>
  <r>test</r>
</register>

Response

See return codes for all codes, here are specific ones:

JSON

400   {"error" : "error parsing the json input"}
400   {"error" : "application_hash missing in notification"}
400   {"error" : "recipient missing in notification"}
400   {"error" : "token missing in notification"}
400   {"error" : "application_hash not found"}

XML

XML returns the same errors string like JSON:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
 <error>application_hash has wrong length</error>
</errors>

Usage examples

cURL (about cURL)

curl -k -X POST -d '{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "t": "bd0d796c80c2c5a972bf01f27397e209f3916edc25436e422281b9fa2d60df40", "r": "test"}' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/recipient/registration.json
curl -k -X POST -d '<?xml version="1.0" encoding="UTF-8"?><register><a>05673b6d12c796afc0cb74849e60573949bf2521</a><t>bd0d796c80c2c5a972bf01f27397e209f3916edc25436e422281b9fa2d60df40</t><r>test</r></register>' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/recipient/registration.xml

Do you have an example to share in the language of your choice? Please share!