Introduction
This article will explain how to manage your APIv2 apps on the App47 portal.
App47 APIv1 Internal Apps
You can easily create, update, delete, and read internal/private Apps in our system. The only required attribute is an App's name. You can optionally specify an icon URL. You may specify JSON or XML as an exchange format. XML is default; thus, if you'd like to use JSON, please use HTTP headers Accept
and Content-Type
.
Required parameter: name
Optional parameters: icon_url
URLs:
Action | HTTP method | URL |
---|---|---|
create | POST | https://cirrus.app47.com/api/apps |
read | GET | https://cirrus.app47.com/api/apps/:app_id |
update | PUT | https://cirrus.app47.com/api/apps/:app_id |
delete | DELETE | https://cirrus.app47.com/api/apps/:app_id |
Note, to see all apps, leave off the :app_id in your HTTP GET.
For example, if using JSON when creating an App, then the resulting document would look something like:
{ app: { name: "API Demo Testing", icon_url: "http://a3.mzstatic.com/us/r1000/067/Purple/76/82/61/mzi.fardqwkk.png" } }
Creating Internal Apps
As an example of creating an App, here is a Node.js call (written in CoffeeScript) using a RESTful POST:
client = require('restler') options = { headers: {'X-Token':'ZSUV222zJ9u24CPIg', 'Accept':"application/json", 'Content-Type': 'application/json' } } createOptions = options createOptions['data'] = JSON.stringify({app:{ name: "API Demo Testing", icon_url: "http://a3.mzstatic.com/us/r1000/067/Purple/76/82/61/mzi.fardqwkk.png" }}) client.post("https://cirrus.app47.com/api/apps", createOptions).on('2XX', (data, response) -> json = JSON.parse(JSON.stringify(data)) console.log "app id is " + json['_id'])
Updating Internal Apps
And to update the same App, use an HTTP PUT. Note, the App ID in this case was obtained from an earlier call to create the App. The App ID is accordingly placed in the URL (i.e. https://cirrus.app47.com/api/apps/080asc23oiuoiuA333)
updateOptions = { headers: {'X-Token':'ZSUV222zJ9u24CPIg', 'Accept':"application/json", 'Content-Type': 'application/json' } } updateOptions['data'] = JSON.stringify({app:{ name: "API Demo Testing updated" }}) client.put("https://cirrus.app47.com/api/apps/" + appId, updateOptions)
Reading/Getting Internal Apps
You can read or GET an App by it's ID as well:
client.get("https://cirrus.app47.com/api/apps/" + appId, options).on('2XX', (data, response) -> console.log JSON.parse(JSON.stringify(data)))
In the code above, appId
is a valid App ID – the response will look something like:
{ _id: '4f340e756f4caf33dD0005e', _type: 'InternalApp', account_id: '4d5303e8b8XC346000002', created_at: '2012-02-09T13:20:38-05:00', icon_url: 'http://a3.mzstatic.com/us/r1000/067/Purple/76/82/61/mzi.fardqwkk.png', name: 'API Demo Testing', settings: [ { _id: '4f340e766f4caf264400005f', default: true, enabled: true, in_app_flow: false, log_level: 'Info', restrict_devices: false } ], test_user_ids: [], updated_at: '2012-02-09T13:20:41-05:00' }
Deleting Internal Apps
Finally, you can also remove an App – just issue an HTTP DELETE and include the App's ID in the URL (just like with GETs and PUTs):
client.del("https://cirrus.app47.com/api/apps/" + appId, options).on('2XX', (data, response) -> console.log "app deleted")
App47 APIv1 External/Public Apps
You can easily create, delete, and read public Apps (i.e. Apps residing in iTunes or Google Play) in our system. The only required attribute is an App's corresponding app store identifier; that is, in Apple's iTunes and Google's Play, Apps have IDs (iTunes IDs look like IDs and Play's look like package names). Updating an external App is not supported as these App types are essentially read-only in our system. You may specify JSON or XML as an exchange format. XML is default; thus, if you'd like to use JSON, please use HTTP headers Accept
and Content-Type
.
Required parameter: apple_external_id
or google_external_id
– NOTE: you can send both as well to create a single App instance for both platforms.
URLs:
Action | HTTP method | URL |
---|---|---|
create | POST | https://cirrus.app47.com/api/external_apps |
read | GET | https://cirrus.app47.com/api/external_apps/:app_id |
delete | DELETE | https://cirrus.app47.com/api/external_apps/:app_id |
For example, if using JSON when creating an External App, such as Adobe Reader, then the resulting document would look something like:
{ app: { apple_external_id: "469337564", google_external_id: "com.adobe.reader" } }
A note about adding Microsoft Windows Phone and Windows 8 Apps:
Because Microsoft does not offer a search-like service (yet) for either the Windows Phone 8 or Windows 8 App stores, adding these app types to App47 requires some additional data, namely, the URL to the respective App store and the App name. For example, if you'd like to add “Cut the Rope” for Windows Phone 8, the corresponding app
JSON would be:
{ wp8_external_id: '4c0cf9f4-31f0-444e-9321-0237d04f6a38', wp8_external_url: 'http://www.windowsphone.com/en-us/store/app/cut-the-rope/4c0cf9f4-31f0-444e-9321-0237d04f6a38', name: 'Cut the Rope' }
And for the Windows 8 store, adding the “ESPN” App would be:
{ windows_external_id: '3c3536bd-f432-468c-a6e4-fa1ecd49e5fc', windows_external_url: 'http://apps.microsoft.com/windows/en-US/app/the-espn-app/3c3536bd-f432-468c-a6e4-fa1ecd49e5fc', name: 'ESPN' }
Creating Public Apps
As an example of creating an App, here is a Node.js call (written in CoffeeScript) using a RESTful POST:
client = require('restler') options = { headers: {'X-Token':'ZSUV222zJ9ssu24CPIg', 'Accept':"application/json", 'Content-Type': 'application/json' } } createOptions = options createOptions['data'] = JSON.stringify({app:{ apple_external_id: "469337564", google_external_id: "com.adobe.reader"}}) client.post("https://cirrus.app47.com/api/external_apps", createOptions).on('2XX', (data, response) -> json = JSON.parse(JSON.stringify(data)) console.log "app id is " + json['_id'])
Reading/Getting Public Apps
You can read or GET an App by it's ID as well:
client.get("https://cirrus.app47.com/api/external_apps/" + appId, options).on('2XX', (data, response) -> console.log JSON.parse(JSON.stringify(data)))
In the code above, appId
is a valid App ID – the response will look something like:
{ _id: '5036dfc06f4caf08ca00000a', _type: 'ExternalApp', account_id: '4d5303e8b8a46d1746000002', apple_external_id: '469337564', created_at: '2012-08-23T21:58:25-04:00', google_external_id: 'com.adobe.reader', icon_url: 'http://lh3.ggpht.com/4ZBFqbNFwegUbsJP5Em5kSGOeNn38ldJDVaVjrzpD58ScNghajRhFBUabeY8H8RP1hc=w124', name: 'Adobe Reader' .... }
Deleting Public Apps
Finally, you can also remove an External App – just issue an HTTP DELETE and include the App's ID in the URL (just like with GETs and PUTs):
client.del("https://cirrus.app47.com/api/external_apps/" + appId, options).on('2XX', (data, response) -> console.log "app deleted")
App47 APIv1 Web/HTML5 Apps
You can easily create, delete, and read Web/HTML5 Apps in our system. The only required attributes are the App's corresponding URL & name. You can optionally supply a version and vendor as well. You may specify JSON or XML as an exchange format. XML is default; thus, if you'd like to use JSON, please use HTTP headers Accept
and Content-Type
.
Required parameters: uri
and name
URLs:
Action | HTTP method | URL |
---|---|---|
create | POST | https://cirrus.app47.com/api/web_apps |
update | PUT | https://cirrus.app47.com/api/web_apps/:app_id |
read | GET | https://cirrus.app47.com/api/web_apps/:app_id |
delete | DELETE | https://cirrus.app47.com/api/web_apps/:app_id |
For example, if using JSON when creating a Web App, such as www.acme.com, then the resulting document would look something like:
{ app: { uri: "http://acme.com", name: "Acme's HTML5 App" } }
Creating Web/HTML5 Apps
As an example of creating an App, here is a Node.js call (written in CoffeeScript) using a RESTful POST:
client = require('restler') options = { headers: {'X-Token':'ZSUV222zJ9ssu24CPIg', 'Accept':"application/json", 'Content-Type': 'application/json' } } createOptions = options createOptions['data'] = JSON.stringify({app:{ uri: "http://acme.com", name: "Acme's HTML5 App"}}) client.post("https://cirrus.app47.com/api/web_apps", createOptions).on('2XX', (data, response) -> json = JSON.parse(JSON.stringify(data)) console.log "app id is " + json['_id'])
Reading/Getting Web/HTML5 Apps
You can read or GET an App by it's ID as well:
client.get("https://cirrus.app47.com/api/web_apps/" + appId, options).on('2XX', (data, response) -> console.log JSON.parse(JSON.stringify(data)))
In the code above, appId
is a valid App ID – the response will look something like:
{ _id: '5036dfc06f4caf08ca00000a', _type: 'WebApp', account_id: '4d5303e8b8a46d1746000002', name: 'Acme.com', uri: 'http://acme.com', .... }
Deleting Web/HTML5 Apps
Finally, you can also remove a Web App – just issue an HTTP DELETE and include the App's ID in the URL (just like with GETs and PUTs):
client.del("https://cirrus.app47.com/api/web_apps/" + appId, options).on('2XX', (data, response) -> console.log "app deleted")
Comments
0 comments
Please sign in to leave a comment.