Home
Version 3
Spaces API

Spaces API

Creating a Space

POST /v2/spaces/

Request

Route

POST /v2/spaces

Body

Name Description Default Valid Values Example Values
name The name of the space
  • development
  • demo
  • production
organization_guid The guid of the associated organization
  • guid-33adefb0-2416-4186-87b2-862f50a2bf5f
developer_guids The list of the associated developers
manager_guids The list of the associated managers
auditor_guids The list of the associated auditors
domain_guids The list of the associated domains
security_group_guids The list of the associated security groups
space_quota_definition_guid The guid of the associated space quota definition
allow_ssh Whether or not Space Developers can enable ssh on apps in the space
{
  "name": "development",
  "organization_guid": "f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0NCIsImVtYWlsIjoiZW1haWwtMTcwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDE2NjI2MDZ9.FgK7OGImIQGK4P2aqmuS4Te_BaG9Y2I_57orA2lw8nY
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0NCIsImVtYWlsIjoiZW1haWwtMTcwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDE2NjI2MDZ9.FgK7OGImIQGK4P2aqmuS4Te_BaG9Y2I_57orA2lw8nY" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "47308410-9d1f-4de1-a681-d365bf50678c",
    "url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c",
    "created_at": "2015-08-31T21:50:06Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85",
    "developers_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/developers",
    "managers_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/managers",
    "auditors_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/auditors",
    "apps_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/apps",
    "routes_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/routes",
    "domains_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/domains",
    "service_instances_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/service_instances",
    "app_events_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/app_events",
    "events_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/events",
    "security_groups_url": "/v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/47308410-9d1f-4de1-a681-d365bf50678c
X-VCAP-Request-ID: cd8c8c06-590f-4c6c-bf2f-642fafff5eb7
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 44
guid 2f334c99-8803-4025-a32f-0ba5c7ab5f8c
created_at 2015-08-31 21:50:06 UTC
updated_at
timestamp 2015-08-31 21:50:06 UTC
type audit.space.create
actor uaa-id-244
actor_type user
actee 47308410-9d1f-4de1-a681-d365bf50678c
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85",
    "allow_ssh": true
  }
}
space_id
organization_guid f1d1fa00-f98c-4bb5-a4f0-b1d518f0be85
space_guid 47308410-9d1f-4de1-a681-d365bf50678c
actor_name email-170@somedomain.com
actee_name development