APPush v0.1 documentation
The device resource represents an iPhone device in the context of an application. The device resource identifier is the device token as reported by APNS.
Returns the current definition for a device record.
- Profile Token
- Profile Secret
- https://appush.com/api/device/<token>
- 200 - OK. The request was completed. Returns device resource object as content-type application/json
- 404 - Not Found.
Example:
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 \
https://appush.com/api/application/I6ieYiJtbH3YPriyR3AK3VZtgSP/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76
HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 06:59:15 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 29
{"tags":["spam","bar","foo"]}
Registers the device token with the application. A list of tags can be provided in the request to group related devices. Tags can be used during the notification process to send a message to a group of devices. If the device record exists, the new request data will overwrite the existing device definition. The HTTP request content-type must be application/json.
- Profile Token
- Profile Secret
- https://appush.com/api/device/<token>
- tags - A list of tags by which to group the device.
- 204 - No Content. The server has fulfilled the request but does not need to return an entity-body.
- 400 - Bad Request. The request contains bad syntax or cannot be fulfilled.
Example:
# Create the device with 'foo', 'bar', 'baz' using Application user
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 -X PUT \
https://appush.com/api/application/I6ieYiJtbH3YPriyR3AK3VZtgSP/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76 \
-d "{\"tags\": [\"foo\",\"bar\",\"baz\"]}" -H "Content-Type: application/json"
HTTP/1.1 204 No Content
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 06:49:50 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 0
# GET the result so we can verify the PUT worked
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 \
https://appush.com/api/application/I6ieYiJtbH3YPriyR3AK3VZtgSP/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76
HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 06:55:10 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 28
{"tags":["baz","bar","foo"]}
# Replace the device's tags
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 \
https://appush.com/api/application/I6ieYiJtbH3YPriyR3AK3VZtgSP/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76 \
-d "{\"tags\": [\"foo\",\"bar\",\"spam\"]}" -H "Content-Type: application/json"
HTTP/1.1 204 No Content
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 06:58:15 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 0
# GET the device to verify the replacement of tags
curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 \
https://appush.com/api/application/I6ieYiJtbH3YPriyR3AK3VZtgSP/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76
HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 06:59:15 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 29
{"tags":["spam","bar","foo"]}
De-activates the device so that notifications are not sent to that device. Devices can be re-enabled by issuing a PUT request. A GET request on a deleted device will return a 404.
- Profile Token
- Profile Secret
- https://appush.com/api/device/<token>
- 204 - No Content. The server has fulfilled the request but does not need to return an entity-body.
Example:
# Remove resource
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 -X DELETE \
https://appush.com/api/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76
HTTP/1.1 204 No Content
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:06:44 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 0
# Verify Resource no longer exists
curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:48907eb5efbffe9ee23e62e2b9273929 https://appush.com/api/device/3734cc9af9376b8cba3704bccbd7c5c7f0901476d07c3247ead2b55f479fbd76
HTTP/1.1 404 Object Not Found
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:08:01 GMT
Content-Type: text/html
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 193
<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD><BODY><H1>Not Found</H1>The requested document was not found on this server.<P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS></BODY></HTML>