Home
Version 3
Apps (Experimental) API

Apps (Experimental) API

Create an App

POST /v3/apps

Creates an app in v3 of the Cloud Controller API. Apps must have a valid space guid for creation, which is namespaced under {"relationships": {"space": "your-space-guid"} }. See the example below for more information.

Request

Route

POST /v3/apps

Body

Name Description Default Valid Values Example Values
name Name of the App
relationships[space][guid] Guid for a particular space
environment_variables Environment variables to be used for the App when running
buildpack Default buildpack to use when staging the application packages. Note: a null value will use autodetection
  • null
  • buildpack name
  • git url
  • ruby_buildpack
  • https://github.com/cloudfoundry/ruby-buildpack
{"name":"my_app","environment_variables":{"open":"source"},"buildpack":"name-576","relationships":{"space":{"guid":"359dbbfd-34a9-42ad-9781-c9ff5413e0e1"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxMiIsImVtYWlsIjoiZW1haWwtMTQ0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDUzNjIzMDZ9.uyKv-zeVcm0hVmvLhmBFsSwpMr8h_7p5F6rPbyyqAB8
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v3/apps" -d '{"name":"my_app","environment_variables":{"open":"source"},"buildpack":"name-576","relationships":{"space":{"guid":"359dbbfd-34a9-42ad-9781-c9ff5413e0e1"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxMiIsImVtYWlsIjoiZW1haWwtMTQ0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDUzNjIzMDZ9.uyKv-zeVcm0hVmvLhmBFsSwpMr8h_7p5F6rPbyyqAB8" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "ed4c903f-9971-40e5-8b25-659ec27b343a",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "buildpack": "name-576",
  "created_at": "2015-10-13T17:31:46Z",
  "updated_at": null,
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a"
    },
    "space": {
      "href": "/v2/spaces/359dbbfd-34a9-42ad-9781-c9ff5413e0e1"
    },
    "processes": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/processes"
    },
    "routes": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/routes"
    },
    "packages": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/packages"
    },
    "droplets": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/droplets"
    },
    "start": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/ed4c903f-9971-40e5-8b25-659ec27b343a/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 28e99abd-3380-4a66-893d-59656259d56a
Content-Length: 1210
X-Content-Type-Options: nosniff