Home
Version 3
Apps (Experimental) API

Apps (Experimental) API

Create a docker 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":"docker","data":{}},"relationships":{"space":{"guid":"e6905b12-bdf1-4018-892f-d92a1bc9917e"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTgiLCJlbWFpbCI6ImVtYWlsLTdAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLnJlYWQiLCJjbG91ZF9jb250cm9sbGVyLndyaXRlIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1NjQ1MjIyMH0.k7biE5GxZfSJQFwUjWM2tCYYg49NT9SwAE0Nt-jbjSw
Content-Type: application/json
Host: example.org
Cookie: 

cURL

curl "https://api.[your-domain.com]/v3/apps" -d '{"name":"my_app","environment_variables":{"open":"source"},"lifecycle":{"type":"docker","data":{}},"relationships":{"space":{"guid":"e6905b12-bdf1-4018-892f-d92a1bc9917e"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTgiLCJlbWFpbCI6ImVtYWlsLTdAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLnJlYWQiLCJjbG91ZF9jb250cm9sbGVyLndyaXRlIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1NjQ1MjIyMH0.k7biE5GxZfSJQFwUjWM2tCYYg49NT9SwAE0Nt-jbjSw" \
	-H "Content-Type: application/json" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "91cba215-34b9-4caf-9f83-298fbcd85cc7",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "created_at": "2016-02-19T02:03:40Z",
  "updated_at": null,
  "lifecycle": {
    "type": "docker",
    "data": {

    }
  },
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7"
    },
    "space": {
      "href": "/v2/spaces/e6905b12-bdf1-4018-892f-d92a1bc9917e"
    },
    "processes": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/processes"
    },
    "route_mappings": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/route_mappings"
    },
    "packages": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/packages"
    },
    "droplets": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/droplets"
    },
    "tasks": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/tasks"
    },
    "start": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/91cba215-34b9-4caf-9f83-298fbcd85cc7/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
X-Runtime: 0.024666
Content-Length: 1354