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-bdafcf1a-534c-488d-b9c8-7e938de3cdfd
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": "ba925946-e227-4272-b5c9-fffc9b3e9d72"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNiIsImVtYWlsIjoiZW1haWwtMTIwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NDJ9.lafqQL5tSBeLc5mS8dcNoeSKtMisfazbZeil9w9kD0c
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": "ba925946-e227-4272-b5c9-fffc9b3e9d72"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNiIsImVtYWlsIjoiZW1haWwtMTIwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NDJ9.lafqQL5tSBeLc5mS8dcNoeSKtMisfazbZeil9w9kD0c" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "7b7cb99e-f793-4bf7-925d-a419a5318bf7",
    "url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7",
    "created_at": "2015-10-15T23:52:22Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "ba925946-e227-4272-b5c9-fffc9b3e9d72",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/ba925946-e227-4272-b5c9-fffc9b3e9d72",
    "developers_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/developers",
    "managers_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/managers",
    "auditors_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/auditors",
    "apps_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/apps",
    "routes_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/routes",
    "domains_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/domains",
    "service_instances_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/service_instances",
    "app_events_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/app_events",
    "events_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/events",
    "security_groups_url": "/v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/7b7cb99e-f793-4bf7-925d-a419a5318bf7
X-VCAP-Request-ID: 3bda3da5-4485-4456-8fc8-3f8158786729
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 176
guid a030fe3f-2051-42b5-a20d-2abb080b0cdc
created_at 2015-10-15 23:52:22 UTC
updated_at
timestamp 2015-10-15 23:52:22 UTC
type audit.space.create
actor uaa-id-216
actor_type user
actee 7b7cb99e-f793-4bf7-925d-a419a5318bf7
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "ba925946-e227-4272-b5c9-fffc9b3e9d72",
    "allow_ssh": true
  }
}
space_id
organization_guid ba925946-e227-4272-b5c9-fffc9b3e9d72
space_guid 7b7cb99e-f793-4bf7-925d-a419a5318bf7
actor_name email-120@somedomain.com
actee_name development