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-2001","relationships":{"space":{"guid":"8e63e218-9c12-460f-af57-f9c320657dad"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwMiIsImVtYWlsIjoiZW1haWwtMjA1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQ3ODI5Mzl9.CB3v5etoMU6vDDLWDYJ1cgxUqEEpxgeTNv4z_1fPmGc
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-2001","relationships":{"space":{"guid":"8e63e218-9c12-460f-af57-f9c320657dad"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwMiIsImVtYWlsIjoiZW1haWwtMjA1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQ3ODI5Mzl9.CB3v5etoMU6vDDLWDYJ1cgxUqEEpxgeTNv4z_1fPmGc" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "74405eaf-24ac-4715-b8ac-b42b1da9cda5",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "buildpack": "name-2001",
  "created_at": "2015-10-07T00:35:39Z",
  "updated_at": null,
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5"
    },
    "space": {
      "href": "/v2/spaces/8e63e218-9c12-460f-af57-f9c320657dad"
    },
    "processes": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/processes"
    },
    "routes": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/routes"
    },
    "packages": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/packages"
    },
    "droplets": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/droplets"
    },
    "start": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/74405eaf-24ac-4715-b8ac-b42b1da9cda5/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 387a0728-bef0-43e9-8355-00f081e27fdc
Content-Length: 1211
X-Content-Type-Options: nosniff