Register a recipient in a group (v2)
Purpose
Associates a recipient with a group.
URL
Sandbox
https://sandbox.squidshot.com/ACCOUNT_KEY/v2/group/registration.json
https://sandbox.squidshot.com/ACCOUNT_KEY/v2/group/registration.xml
Production
https://production.httpush.com/ACCOUNT_KEY/v2/group/registration.json
https://production.httpush.com/ACCOUNT_KEY/v2/group/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.
a: Theapplication_hash. Provided by the management site. Identifies under which application the recipient should be created.r: Arecipient_key(an application wide unique identifier for a given recipient). Can be anything you want but you should hash therecipient_keyto make its encoding save for the web. You should use a SHA-1 hash on therecipient_key. The max. length is 128 characters. Therecipient_keyshould be unique. This is the key to send messages later to.g: Thegroup_hash. Provided by the management site. Identifies under which group the recipient should be created.
Usage Notes
recipient_key should be URL encoded.
Example JSON data
{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "g": "849275d12c796afc0cb74849e60573949849275", "r": "test"}
Example XML data
<?xml version="1.0" encoding="UTF-8"?> <register> <a>05673b6d12c796afc0cb74849e60573949bf2521</a> <g>849275d12c796afc0cb74849e60573949849275</g> <r>test</r> </register>
Response
See return codes for all codes, here are specific ones:
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 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", "g": "849275d12c796afc0cb74849e60573949849275", "r": "test"}' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/registration.json
curl -k -X POST -d '<?xml version="1.0" encoding="UTF-8"?><register><a>05673b6d12c796afc0cb74849e60573949bf2521</a><g>849275d12c796afc0cb74849e60573949849275</g><r>test</r></register>' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/registration.xml
Do you have an example to share in the language of your choice? Please share!