In using CloudFoundry, I find myself using the CLI more often than not. This works for me very well because I enjoy using CLIs more often than not, however some things can also be done with scripting.
CloudFoundry introduces a REST API available to your installation. This is found here. One of the things you'll notice quickly is that one of the headers has to have an "authorization" token. This can be obtained by running the command:
The results can be added to the curl commands as described in the API docs. So that means that something like:
curl "https://$DOMAIN_URL/v2/apps" -X GET \
-H "Authorization: $TOKEN"
where $DOMAIN_URL is your CloudFoundry API Endpoint, and $TOKEN is whatever is returned by the cf oauth-token command.
Of course, if you simply prefer to make straight calls to the API, you can use the cf curl command which adds these headers to your HTTP request for free (pending authentication to your given CF instance). So for the example above, you'll have something like this:
cf curl /v2/apps
I'm looking forward to experiment with other CF components shortly such as BOSH.