Send a notification to a group (v2)
Purpose
Sends a notification to every recipient in a group.
URL
Sandbox
https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/notification.json
https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/notification.xml
Production
https://production.httpush.com/ACCOUNT_KEY/v2/group/notification.json
https://production.httpush.com/ACCOUNT_KEY/v2/group/notification.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: The application_hash. Provided by the management site. Identifies under which application the recipient should be created.g: The group_hash. Provided by the management site. Identifies the group to send the notification to.-
b: Have a look at the documentation provided by Apple, to learn how the payload should be formated, basically it is:
{"aps":{"badge":1,"alert":"Hi from the API"}}
Usage Notes
json_body is not allowed to be larger than 256 byte.
Example JSON data
{"a": "05673b6d12c796afc0cb74849e60573949bf2521", "b": "{\"aps\":{\"badge\":1,\"alert\":\"Hi from squidshot!\"}}", "g": "849275d12c796afc0cb74849e60573949849275"}
Example XML data
<?xml version="1.0" encoding="UTF-8"?> <notification> <a>05673b6d12c796afc0cb74849e60573949bf2521</a> <b>{"aps":{"badge":1,"alert":"Hi from squidshot!"}}</b> <g>849275d12c796afc0cb74849e60573949849275</g> </notification>
Responses
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" : "group_hash missing in notification"}
400 {"error" : "json body is 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", "b": "{\"aps\":{\"badge\":1,\"alert\":\"Hi from squidshot!\"}}", "g": "849275d12c796afc0cb74849e60573949849275"}' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/notification.json
curl -k -X POST -d '<?xml version="1.0" encoding="UTF-8"?><notification><a>05673b6d12c796afc0cb74849e60573949bf2521</a><b>{"aps":{"badge":1,"alert":"Hi from squidshot!"}}</b><g>849275d12c796afc0cb74849e60573949849275</g></notification>' -u 'c3bb3b10864278055b3873503629904b98862895:1ab182418e3bca321dab504f96dd0339869eef0c' https://sandbox.httpush.com/ACCOUNT_KEY/v2/group/notification.xml
Do you have an example to share in the language of your choice? Please share!