Getting Acquainted with the App Center API
*Quick Update as of Aug 1st, 2013 - The user-based "limited lifetime" API key will not work. I'll try to provide an update once I determine root-cause but until then please use the M2M/static API keys.
The App Center API is a great means of extracting information from App Center as well as automating processes such as uploading Apps or creatign web apps. This article is intended to provide a cursory introduction to using the API.
Both examples are written in Python and tested on version 2.7.1
More detailed documentation on the API is avaiable here: http://www.symantec.com/docs/DOC6376
Info about the scripts:
getReport.py will call the "App List" and "Download Count by Hour" and return the data both unformatted and formatted respectively.
postEncode.py will create a webclip Web App for iOS by calling the "Create Web App" method. This is a particularly interesting one as you need to load the icon file you will use for the app into memory first. In this case, include the icon file in the same directory as this script and name it icon.png (or change the file name in the script on line 42 - I've included an icon for you just in case). Also note that a nice recipe from activestate.com was used to help generate the body of the POST. Lastly feel free to change any of the parameters for the metadata (metaD variable) and URL that will be created for the web app, etc.
For both scripts, you will need to populate both the apiKey variable and the URLs in each script. The url is simply the name of your app center (ex. https://myappcenter.appcenterhq.com), leave the remaining portion of the URL intact. To generate an API get, log into your App Center, go to Settings>API and there will be an option to genearte the key.
As a side note, getReport.py has a function for generating a user based key, more on that in another post, but again feel free to play around.