Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
AppFog API Documentation
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md

README.md

AppFog API Documentation

AppFog provides an easy-to-use public-facing REST API that users can use to manage their AppFog applications. At the moment, not all app-based functionality is covered by this API (including actions such as clone/redeploy). However, the vast majority of actions currently are available, including af push, af update, af create-service, and so on.

Basic form of API requests

The AppFog API does not use Basic Auth to enable API requests. Instead, every AppFog user is given an AppFog token that enables them to use the API. This token can be found in the ~/.af_token file on your machine. We recommend using your token as an environment variable, which I will do in these docs:

export AF_TOKEN=<your_appfog_token>

Once you have done this, you can invoke that environment variable using $AF_TOKEN. Let's make a simple cURL request using the token:

curl -H X-Auth:$AF_TOKEN -X GET https://api.appfog.com/apps

This cURL request corresponds to the af apps command and lists all of the applications associated with a user's account. All AppFog API requests should begin with curl -H Authorization:$AF_TOKEN.

API actions

URL HTTP Verb Action AppFog CLI command
/info GET Returns a variety of information, including currently-supported runtimes, user payment tier, and so on. af info
/apps GET Lists all apps for a user af apps
/apps/app-name GET Returns a variety of information about a specific application, including runtime, URI(s), instances, resources, state, bound services, infra, environment variables, and so on. N/A
/apps/app-name/stats GET Returns stats for a specific application, including URI(s), IP address, uptime, memory quota, HTTP port, and so on. af stats
/services GET Lists all the services associated with a user, including MySQL, PostgresQL, MongoDB, and Redis databases, as well as RabbitMQ messaging systems. af services
/apps/app-name PUT Updates an application. af update
/services POST Creates a services. af create-service
/apps POST Registers an application. N/A
/apps/app-name/application GET Downloads a ZIP blob of all application code. af download
/apps/app-name/application POST Uploads an application via a form. N/A
/services/export/service-name GET Returns a URL to be used to initiate a SQL dump. af export-service
/services/service-name POST Import an SQL file. af import-service
/infras GET Lists currently available infrastructures, as well as their associated names (for example eu-aws for AWS-Europe (Ireland). af infras
/apps/app-name DELETE Deletes an app. af delete

Sample requests for more sophisticated actions

The following examples will involve an AppFog application called my_app and a service called my_service, as well as the $AF_TOKEN used previously. Here, we want to show you how to perform actions that involve tags in the command line, such as --infra tags (to give just one example).

If you want to push an application to a specific infrastructure, this is done via an --infra tag:

af push my_app --infra rs

This will push my_app to Rackspace. If an --infra tag is not specified, you will be prompted to manually choose an infrastructure. To accomplish this via the AppFog API, you'll need to specify the app name and infra in the request body:

curl -H X-Auth:$AF_TOKEN -X POST -b {"name":"my_app","infra":{"provider":"rs"}} https://api.appfog.com/apps

There are a variety of other actions that can be performed through the API. These will be documented soon.

Existing clients

At the moment, there are no official clients for the AppFog API. There are however, clients for the Cloud Foundry API in Ruby, JavaScript/Node.js and Java. Please be advised that these clients may support the AppFog-specific commands that you need (such as af start, af push, and af create-service), but there are many unsupported commands (such as af clone and others). In many cases, it will be more advisable to simply target URLs directly rather than running commands through a runtime-specific wrapper.

More info

If you have any further questions about the AppFog API, please contact Luc Perkins at luc@appfog.com.

Something went wrong with that request. Please try again.