Overview
What will follow is a whirlwind tour of the way the HTTPush web service works.
Essential reads
- Read the Guide from Apple on Push Notification, it explains a lot of the terminology used.
- For an overview what you can do with the API read this article: The four most common use cases for push notification.
Push explained from a phones view
- The iPhone requests a token via an Objective-C call.
- This token needs to be send, along with a
recipient_key(an application wide unique identifier eg. a username), to the HTTPush web service. - You can send a message to the HTTPush web service with the
recipient_keyand the message is forwarded to the device which belongs to the token stored.
Step 1 and 2 need to be done every time your iPhone app launches. It should not be done on the main thread for performance reasons.
What you need to do to use the API
- You need to be a registered iPhone developer.
- You login into the developer account and create the necessary certificate.
- You sign up for an HTTPush web service account.
- You login to the HTTPush web service management site at
h.squidshot.com/:your-account-name. - You create a new application and upload the certificate.
- You create a new API-User for the application.
- Use any HTTP library to send messages to the HTTPush web service using the application_hash and the API-User’s key and password.
API calls
- Register a recipient with a token and a recipient_key in a specific application.
- Send a notification to a recipient identified by his recipient_key in a specific application.
- Deregister a recipient identified by a recipient_key from a specific application.
- Send a notification to all recipients in a given application.
- Get the Apple APNS token for a recipient_key.
- Register a recipient in a given group.
- Deregister a recipient from a given group.
- Send a notification to one or more groups.
- Get statistics about sent notifications.
About the HTTPush web service
- Applications are identified by an application hash provided by the HTTPush web service management site.
- You can create multiple applications. Recipients are separated per application.
- Groups are identified by a group hash provided by the HTTPush web service management site.
- You can create multiple groups. Groups are separated per application.
- A Recipient can be a member of one or more groups at the same time.
- The API supports JSON and XML. Learn more about JSON at www.json.org. The content-type is distinguished by the URL ending.
- All API calls go to either
https://sandbox.httpush.com/ACCOUNT_KEYorhttps://production.httpush.com/ACCOUNT_KEY, not to the management web site URL. - Encoding for all calls should be UTF-8.
- All calls should use HTTPS.
- Production and Sandbox have different URL prefixes. See the individual calls for the exact URL.