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
lifecycle Lifecycle to be used when creating the app. Note: If no lifecycle is provided, lifecycle type defaults to buildpack. Data is a required field in lifecycle
{"name":"my_app","environment_variables":{"open":"source"},"lifecycle":{"type":"buildpack","data":{"stack":null,"buildpack":"name-74"}},"relationships":{"space":{"guid":"33b637ca-9c95-43fa-9fc8-6bf433389a0e"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwIiwiZW1haWwiOiJlbWFpbC05QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDcxMTY4MjR9.mIjdQvwtKRnGMgDO9Vb9Dhd6rCyCqASCiZXqnIc9fuo
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"},"lifecycle":{"type":"buildpack","data":{"stack":null,"buildpack":"name-74"}},"relationships":{"space":{"guid":"33b637ca-9c95-43fa-9fc8-6bf433389a0e"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwIiwiZW1haWwiOiJlbWFpbC05QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDcxMTY4MjR9.mIjdQvwtKRnGMgDO9Vb9Dhd6rCyCqASCiZXqnIc9fuo" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "f5a38e86-4027-4469-87dd-e8f43daac974",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "created_at": "2015-11-03T00:53:44Z",
  "updated_at": null,
  "lifecycle": {
    "type": "buildpack",
    "data": {
      "buildpack": "name-74",
      "stack": "default-stack-name"
    }
  },
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974"
    },
    "space": {
      "href": "/v2/spaces/33b637ca-9c95-43fa-9fc8-6bf433389a0e"
    },
    "processes": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/processes"
    },
    "routes": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/routes"
    },
    "packages": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/packages"
    },
    "droplets": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/droplets"
    },
    "start": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/f5a38e86-4027-4469-87dd-e8f43daac974/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 8a0da203-1318-4005-ae38-ef88c5a2f508
Content-Length: 1316
X-Content-Type-Options: nosniff