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.
POST /v3/apps
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-2489"}},"relationships":{"space":{"guid":"71920bd7-fb9c-4a81-8d79-2cc25796d3cd"}}}
Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQ0OSIsImVtYWlsIjoiZW1haWwtMzE2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDgwMzg5NzV9.yw9DJhwfY7aAU5rMVgi8F8uMor4RVrucZRPNKUiItyE Content-Type: application/json Host: example.org Cookie:
curl "https://api.[your-domain.com]/v3/apps" -d '{"name":"my_app","environment_variables":{"open":"source"},"lifecycle":{"type":"buildpack","data":{"stack":null,"buildpack":"name-2489"}},"relationships":{"space":{"guid":"71920bd7-fb9c-4a81-8d79-2cc25796d3cd"}}}' -X POST \ -H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQ0OSIsImVtYWlsIjoiZW1haWwtMzE2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5yZWFkIiwiY2xvdWRfY29udHJvbGxlci53cml0ZSJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDgwMzg5NzV9.yw9DJhwfY7aAU5rMVgi8F8uMor4RVrucZRPNKUiItyE" \ -H "Content-Type: application/json" \ -H "Host: example.org" \ -H "Cookie: "
201 Created
{ "guid": "545517c7-46e1-4dee-bf7f-3488f9ed9a72", "name": "my_app", "desired_state": "STOPPED", "total_desired_instances": 0, "created_at": "2015-11-13T17:02:55Z", "updated_at": null, "lifecycle": { "type": "buildpack", "data": { "buildpack": "name-2489", "stack": "default-stack-name" } }, "environment_variables": { "open": "source" }, "links": { "self": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72" }, "space": { "href": "/v2/spaces/71920bd7-fb9c-4a81-8d79-2cc25796d3cd" }, "processes": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/processes" }, "routes": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/routes" }, "packages": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/packages" }, "droplets": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/droplets" }, "start": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/start", "method": "PUT" }, "stop": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/stop", "method": "PUT" }, "assign_current_droplet": { "href": "/v3/apps/545517c7-46e1-4dee-bf7f-3488f9ed9a72/current_droplet", "method": "PUT" } } }
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.032429 Content-Length: 1318