Deregister a recipient (v2)
Purpose
Removes a recipient from a given application.
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
DELETE
Formats
JSON, XML
Requires Authentication
Yes (about Authentication)
Parameters
Send the parameters as either JSON or XML data as the body of your request.
a: The application_hash. Provided by the management site. Identifies under which application the recipient should be created.r: A recipient_key (an application wide unique identifier for a given user). Can be anything you want but you should hash the username to make its encoding save for the web. You should use a SHA-1 hash on the username. The max. length is 128 characters. The recipient_key should be unique.
Usage Notes
recipient_key should be URL encoded.
Example JSON data
{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "r": "test"}
Example XML data
<?xml version="1.0" encoding="UTF-8"?> <deregister> <a>05673b6d12c796afc0cb74849e60573949bf2521</a> <r>test</r> </deregister>
Response
See return codes for all codes, here are specific ones:
400 {"error" : "error parsing the input"}
400 {"error" : "application_hash is missing"}
400 {"error" : "application_hash has wrong length"}
400 {"error" : "user_name is missing"}
400 {"error" : "user_name is too long (100 chars max)"}
400 {"error" : "application_hash not found"}
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 DELETE -d '{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "r": "test"}' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/recipient/registration.json
curl -k -X DELETE -d '<?xml version="1.0" encoding="UTF-8"?><register><a>05673b6d12c796afc0cb74849e60573949bf2521</a><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!