Creating an App
POST /v2/apps/
Request
Route
POST /v2/apps
Body
Name |
Description |
Default |
Valid Values |
Example Values |
name
|
The name of the app.
|
|
|
|
memory
|
The amount of memory each instance should have. In megabytes.
|
|
|
|
instances
|
The number of instances of the app to run. To ensure optimal availability, ensure there are at least 2 instances.
|
|
|
|
disk_quota
|
The maximum amount of disk available to an instance of an app. In megabytes.
|
|
|
|
space_guid
|
The guid of the associated space.
|
|
|
- guid-5f0c756b-e127-43fa-92a4-5505899efec2
|
stack_guid
|
The guid of the associated stack.
|
Uses the default system stack.
|
|
- guid-f9f5b7e5-c509-4eeb-9aed-dace6b4fe9b1
|
state
|
The current desired state of the app. One of STOPPED or STARTED.
|
STOPPED
|
|
|
detected_start_command
|
The command detected by the buildpack during staging.
|
|
|
|
command
|
The command to start an app after it is staged, maximum length: 4096 (e.g. 'rails s -p $PORT' or 'java com.org.Server $PORT').
|
|
|
|
buildpack
|
Buildpack to build the app. 3 options: a) Blank means autodetection; b) A Git Url pointing to a buildpack; c) Name of an installed buildpack.
|
|
|
- https://github.com/virtualstaticvoid/heroku-buildpack-r.git
- an_example_installed_buildpack
|
health_check_type
|
Type of health check to perform.
|
port
|
|
|
health_check_timeout
|
Timeout for health checking of an staged app when starting up
|
|
|
|
diego
|
Use diego to stage and to run when available
|
false
|
|
|
docker_image
|
Name of the Docker image containing the app
|
|
|
- cloudfoundry/helloworld
- registry.example.com:5000/user/repository/tag
|
environment_json
|
Key/value pairs of all the environment variables to run in your app. Does not include any system or service variables.
|
|
|
|
production
|
Deprecated.
|
true
|
|
|
console
|
Open the console port for the app (at $CONSOLE_PORT).
|
false
|
|
|
debug
|
Open the debug port for the app (at $DEBUG_PORT).
|
false
|
|
|
name
|
The name of the app.
|
|
|
|
memory
|
The amount of memory each instance should have. In megabytes.
|
|
|
|
instances
|
The number of instances of the app to run. To ensure optimal availability, ensure there are at least 2 instances.
|
|
|
|
disk_quota
|
The maximum amount of disk available to an instance of an app. In megabytes.
|
|
|
|
space_guid
|
The guid of the associated space.
|
|
|
- guid-dee29571-be4e-4925-afff-57f7c8fdab23
|
stack_guid
|
The guid of the associated stack.
|
Uses the default system stack.
|
|
- guid-18c58cee-375e-4356-a420-90f8a2de0061
|
state
|
The current desired state of the app. One of STOPPED or STARTED.
|
STOPPED
|
|
|
detected_start_command
|
The command detected by the buildpack during staging.
|
|
|
|
command
|
The command to start an app after it is staged, maximum length: 4096 (e.g. 'rails s -p $PORT' or 'java com.org.Server $PORT').
|
|
|
|
buildpack
|
Buildpack to build the app. 3 options: a) Blank means autodetection; b) A Git Url pointing to a buildpack; c) Name of an installed buildpack.
|
|
|
- https://github.com/virtualstaticvoid/heroku-buildpack-r.git
- an_example_installed_buildpack
|
health_check_type
|
Type of health check to perform.
|
port
|
|
|
health_check_timeout
|
Timeout for health checking of an staged app when starting up
|
|
|
|
diego
|
Use diego to stage and to run when available
|
false
|
|
|
docker_image
|
Name of the Docker image containing the app
|
|
|
- cloudfoundry/helloworld
- registry.example.com:5000/user/repository/tag
|
environment_json
|
Key/value pairs of all the environment variables to run in your app. Does not include any system or service variables.
|
|
|
|
production
|
Deprecated.
|
true
|
|
|
console
|
Open the console port for the app (at $CONSOLE_PORT).
|
false
|
|
|
debug
|
Open the debug port for the app (at $DEBUG_PORT).
|
false
|
|
|
{
"name": "my_super_app",
"space_guid": "50b7ada0-134b-486a-a08d-284e8c6581aa"
}
Headers
cURL
curl "https://api.[your-domain.com]/v2/apps" -d '{
"name": "my_super_app",
"space_guid": "50b7ada0-134b-486a-a08d-284e8c6581aa"
}' -X POST \
-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTk0IiwiZW1haWwiOiJlbWFpbC05M0Bzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDMyMzEzNjEwfQ.37hVVLznAlPiHW1CwIz5nGTs6klY0i2m4nB1s-sHwHc" \
-H "Host: example.org" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Cookie: "
Response
Status
201 Created
Body
{
"metadata": {
"guid": "2dbf56db-73b1-444d-a9fe-8a59ae86f2de",
"url": "/v2/apps/2dbf56db-73b1-444d-a9fe-8a59ae86f2de",
"created_at": "2015-05-15T16:53:30Z",
"updated_at": null
},
"entity": {
"name": "my_super_app",
"production": false,
"space_guid": "50b7ada0-134b-486a-a08d-284e8c6581aa",
"stack_guid": "bf7ce60b-12d4-4c80-9b00-c34ea7045369",
"buildpack": null,
"detected_buildpack": null,
"environment_json": {
},
"memory": 1024,
"instances": 1,
"disk_quota": 1024,
"state": "STOPPED",
"version": "4525cd44-3b11-48c0-a113-eb95b00e9be6",
"command": null,
"console": false,
"debug": null,
"staging_task_id": null,
"package_state": "PENDING",
"health_check_type": "port",
"health_check_timeout": null,
"staging_failed_reason": null,
"diego": false,
"docker_image": null,
"package_updated_at": null,
"detected_start_command": "",
"enable_ssh": true,
"space_url": "/v2/spaces/50b7ada0-134b-486a-a08d-284e8c6581aa",
"stack_url": "/v2/stacks/bf7ce60b-12d4-4c80-9b00-c34ea7045369",
"events_url": "/v2/apps/2dbf56db-73b1-444d-a9fe-8a59ae86f2de/events",
"service_bindings_url": "/v2/apps/2dbf56db-73b1-444d-a9fe-8a59ae86f2de/service_bindings",
"routes_url": "/v2/apps/2dbf56db-73b1-444d-a9fe-8a59ae86f2de/routes"
}
}
Headers
Audit Records Created By The Request
Audit Record: audit.app.create
Attribute Name |
Value |
id
|
20
|
guid
|
3ed9d491-0261-4f9d-91ef-79382dd85d3b
|
created_at
|
2015-05-15 16:53:30 UTC
|
updated_at
|
|
timestamp
|
2015-05-15 16:53:30 UTC
|
type
|
audit.app.create
|
actor
|
uaa-id-94
|
actor_type
|
user
|
actee
|
2dbf56db-73b1-444d-a9fe-8a59ae86f2de
|
actee_type
|
app
|
metadata
|
{
"request": {
"name": "my_super_app",
"space_guid": "50b7ada0-134b-486a-a08d-284e8c6581aa",
"console": false,
"environment_json": "PRIVATE DATA HIDDEN",
"health_check_type": "port",
"instances": 1,
"production": false,
"state": "STOPPED"
}
}
|
space_id
|
89
|
organization_guid
|
b4fad438-998d-4a91-9a0e-930fe3006f81
|
space_guid
|
50b7ada0-134b-486a-a08d-284e8c6581aa
|
actor_name
|
email-93@somedomain.com
|
actee_name
|
my_super_app
|