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-598"}},"relationships":{"space":{"guid":"8de6eb76-d60f-4b3f-8cfa-a3801f798788"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExOSIsImVtYWlsIjoiZW1haWwtODVAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLnJlYWQiLCJjbG91ZF9jb250cm9sbGVyLndyaXRlIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ0OTUzMTUxNn0.DDLW3h2OZHX__QtqxmY49-lP2vpaz4-xNOGmSbR0AqY
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":"buildpack","data":{"stack":null,"buildpack":"name-598"}},"relationships":{"space":{"guid":"8de6eb76-d60f-4b3f-8cfa-a3801f798788"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExOSIsImVtYWlsIjoiZW1haWwtODVAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLnJlYWQiLCJjbG91ZF9jb250cm9sbGVyLndyaXRlIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ0OTUzMTUxNn0.DDLW3h2OZHX__QtqxmY49-lP2vpaz4-xNOGmSbR0AqY" \
	-H "Content-Type: application/json" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "d6b41085-8850-4280-a6f4-088059415664",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "created_at": "2015-11-30T23:38:36Z",
  "updated_at": null,
  "lifecycle": {
    "type": "buildpack",
    "data": {
      "buildpack": "name-598",
      "stack": "default-stack-name"
    }
  },
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664"
    },
    "space": {
      "href": "/v2/spaces/8de6eb76-d60f-4b3f-8cfa-a3801f798788"
    },
    "processes": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/processes"
    },
    "routes": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/routes"
    },
    "packages": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/packages"
    },
    "droplets": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/droplets"
    },
    "start": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/d6b41085-8850-4280-a6f4-088059415664/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.034948
Content-Length: 1317