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-1893"}},"relationships":{"space":{"guid":"763e5fc6-ad5e-4958-9632-adc6bd7bb2b7"}}}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI2NCIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NTN9.OkGkWI7dPJeqfR9yM2qZa5Jzqnx2eSucm59E__0TNmU
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-1893"}},"relationships":{"space":{"guid":"763e5fc6-ad5e-4958-9632-adc6bd7bb2b7"}}}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI2NCIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NTN9.OkGkWI7dPJeqfR9yM2qZa5Jzqnx2eSucm59E__0TNmU" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "guid": "8722a286-6d03-46eb-bf29-4c14fcbe925d",
  "name": "my_app",
  "desired_state": "STOPPED",
  "total_desired_instances": 0,
  "created_at": "2015-10-15T23:52:33Z",
  "updated_at": null,
  "lifecycle": {
    "type": "buildpack",
    "data": {
      "stack": null,
      "buildpack": "name-1893"
    }
  },
  "environment_variables": {
    "open": "source"
  },
  "links": {
    "self": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d"
    },
    "space": {
      "href": "/v2/spaces/763e5fc6-ad5e-4958-9632-adc6bd7bb2b7"
    },
    "processes": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/processes"
    },
    "routes": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/routes"
    },
    "packages": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/packages"
    },
    "droplets": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/droplets"
    },
    "start": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/start",
      "method": "PUT"
    },
    "stop": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/stop",
      "method": "PUT"
    },
    "assign_current_droplet": {
      "href": "/v3/apps/8722a286-6d03-46eb-bf29-4c14fcbe925d/current_droplet",
      "method": "PUT"
    }
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 790a7820-858f-4df9-b1d2-989dec7e0584
Content-Length: 1302
X-Content-Type-Options: nosniff