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-9ebb4f85-8e86-4d39-b411-eace21023187
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": "6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MSIsImVtYWlsIjoiZW1haWwtMjg3QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzUxMDI4NjV9.vdV6X1wf0KI8PzNGrXkDD3BBHaql7b3LgAoWK7CkfUM
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": "6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MSIsImVtYWlsIjoiZW1haWwtMjg3QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzUxMDI4NjV9.vdV6X1wf0KI8PzNGrXkDD3BBHaql7b3LgAoWK7CkfUM" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "6c1fe603-71f1-4f37-93fb-04b674d9bebc",
    "url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc",
    "created_at": "2015-06-16T23:41:05Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce",
    "developers_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/developers",
    "managers_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/managers",
    "auditors_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/auditors",
    "apps_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/apps",
    "routes_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/routes",
    "domains_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/domains",
    "service_instances_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/service_instances",
    "app_events_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/app_events",
    "events_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/events",
    "security_groups_url": "/v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/6c1fe603-71f1-4f37-93fb-04b674d9bebc
X-VCAP-Request-ID: c6c02a78-bc72-415f-b95d-fd6331875e98
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 172
guid b12ac628-bad8-419f-b05b-255f33f09133
created_at 2015-06-16 23:41:05 UTC
updated_at
timestamp 2015-06-16 23:41:05 UTC
type audit.space.create
actor uaa-id-371
actor_type user
actee 6c1fe603-71f1-4f37-93fb-04b674d9bebc
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce",
    "allow_ssh": true
  }
}
space_id 175
organization_guid 6a6e43ef-7337-47f7-b3ad-6a6cee3b5bce
space_guid 6c1fe603-71f1-4f37-93fb-04b674d9bebc
actor_name email-287@somedomain.com
actee_name development