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-1389","relationships":{"space":{"guid":"fe521728-54fe-4a94-93d6-99e1a516d5a3"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0MyIsImVtYWlsIjoiZW1haWwtMTQwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQyNjA2NDR9._iJ2qAs_zpP_DjtpbLORi13H2txIMzQHogeV4R_OQUc
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-1389","relationships":{"space":{"guid":"fe521728-54fe-4a94-93d6-99e1a516d5a3"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0MyIsImVtYWlsIjoiZW1haWwtMTQwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQyNjA2NDR9._iJ2qAs_zpP_DjtpbLORi13H2txIMzQHogeV4R_OQUc" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "3e53c3a7-f196-4d9f-a2ed-01437e196f49",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "buildpack": "name-1389",
  "created_at": "2015-09-30T23:30:44Z",
  "updated_at": null,
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49"
    },
    "space": {
      "href": "/v2/spaces/fe521728-54fe-4a94-93d6-99e1a516d5a3"
    },
    "processes": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/processes"
    },
    "routes": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/routes"
    },
    "packages": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/packages"
    },
    "droplets": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/droplets"
    },
    "start": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/3e53c3a7-f196-4d9f-a2ed-01437e196f49/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: dcc3ffac-8eca-4ea3-8261-c1284694628b
Content-Length: 1211
X-Content-Type-Options: nosniff