APPush v0.1 documentation
The application resource gives the developer the ability to programmatically create an application without using the Appush web administration page.
Creates an application resource and returns the application id. The HTTP request content-type must be application/json.
- Root Token
- Root Secret
- name - A string to identify the application (required).
- env - dev or prod [default: dev]
- dev_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for development use.
- prod_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for production use.
Example JSON (the dev_pem field has been truncated):
{
"name": "My New Application"
"env": "dev",
"dev_pem": "Bag Attributes\n ...",
}
- 201 - Created. The request has been fulfilled and resulted in a new resource being created. The JSON response will include the id of the application created. This id is used to fetch the new application resource. A Location header is also provided with the absolute path to the new resource.
- 502 - Bad Gateway. The PEM strings provided are not valid.
Example (the dev_pem field has been truncated):
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:72781d3c6d508699e8f3918de6dceb25 https://appush.com/api/application/
> -d "{"name":"My New Application", "status":"dev","dev_pem":"Bag Attributes\n ...", "}
> -H "Content-Type: application/json" -X POST
HTTP/1.1 201 Created
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:51:33 GMT
Content-Type: application/json
Location: https://appush.com/api/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 36
{"id":"P9haDs2EjJmyuYwEpxio2KPZ4SH"}
Replaces an application resource definition. The HTTP request content-type must be application/json.
- Root Token
- Root Secret
- name - A string to identify the application (required).
- env - dev or prod [default: dev]
- dev_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for development use.
- prod_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for production use.
Example JSON (the dev_pem field has been truncated):
{
"name": "My New Application"
"env": "dev",
"dev_pem": "Bag Attributes\n ...",
}
- 204 - No Content. The server has fulfilled the request but does not need to return an entity-body.
- 502 - Bad Gateway. The PEM strings provided are not valid.
Example (the dev_pem field has been truncated):
$ curl -i -u I6ieYiJtbH3YPriyR3AK3VZtgSP:72781d3c6d508699e8f3918de6dceb25 https://appush.com/api/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
> -d "{"name":"My New Application", "status":"dev","dev_pem":"Bag Attributes\n ...", "}
> -H "Content-Type: application/json" -X PUT
HTTP/1.1 204 No Content
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:51:33 GMT
Content-Type: application/json
Location: https://appush.com/api/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 0
Returns a list of applications.
- Root Token
- Root Secret
- 200 - OK. The request was completed. The JSON response will include a list of application ids.
Example:
$ curl -ik -u I6ieYiJtbH3YPriyR3AK3VZtgSP:72781d3c6d508699e8f3918de6dceb25 https://appush.com/api/application
HTTP/1.1 200 Accepted
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:55:02 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 222
["P9haDs2EjJmyuYwEpxio2KPZ4SH"]
Returns the application object.
- Root Token
- Root Secret
- 200 - OK. The request was completed. The JSON response will include application_token and application_secret.
- 404 - Not Found.
- name - A string to identify the application (required).
- env - dev or prod [default: dev]
- dev_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for development use.
- prod_pem - The PEM generated string from openssl that is associated with the p12 file provide by Apple for production use.
- active_devices - Count of active devices for this application.
Example:
$ curl -ik -u I6ieYiJtbH3YPriyR3AK3VZtgSP:72781d3c6d508699e8f3918de6dceb25 https://appush.com/api/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
HTTP/1.1 200 Accepted
Server: nginx/0.7.62
Date: Fri, 13 Nov 2009 07:55:02 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=20
Content-Length: 222
{"name":"My New Application", "application_token": "EVtmyITWMKzDRtawXxubVmfIYWU", "application_secret": "e52c6cbd232e2111671953d320ff80a2", "status":"dev","dev_pem":"Bag Attributes\n ...", "active_devices":0}
Deletes an application.
- Root Token
- Root Secret
- 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/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
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/application/P9haDs2EjJmyuYwEpxio2KPZ4SH
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>
Developers may also upload icons for their applications via the API.
Creates or updates the icon for the referenced application. The HTTP request content-type must be image/png. The icon must be a 57x57 PNG image.
- Root Token
- Root Secret
- https://appush.com/api/application/<id>/icon
The body of the request should be the image data. Here is a simple example of submitting an icon from Ruby
req = Net::HTTP::Put.new(URI.encode(‘https://appush.com/api/application/my_app_id/icon’)) req.basic_auth “root_token”, “root_secret” req.content_type=’image/png’ req.body = File.read(“/local/path/to/application/icon.png”) Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
- 204 - No Content. The server has fulfilled the request but does not need to return an entity-body.
- 415 - Unsupported Media Type. The submitted icon is not a 57x57 PNG image.
Returns the application icon.
- Root Token
- Root Secret
- https://appush.com/api/application/<id>/icon
- 200 - OK. The request was completed. The response content type is ‘image/png’ and the response body in the image data.
Deletes an application icon.
- Root Token
- Root Secret
- https://appush.com/api/application/<id>/icon
- 204 - No Content. The server has fulfilled the request but does not need to return an entity-body.