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-0e43c756-5843-423a-9061-ed63653e5b11
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
{
  "name": "development",
  "organization_guid": "6cec7a73-a9b3-4c69-b740-95437327d92c"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwOCIsImVtYWlsIjoiZW1haWwtNzBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQyNzMyMzk2MH0.96oMyAHw11XUHnwxT6OR5x9Adm5llxlBhw6HGTU_Dsg
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": "6cec7a73-a9b3-4c69-b740-95437327d92c"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwOCIsImVtYWlsIjoiZW1haWwtNzBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQyNzMyMzk2MH0.96oMyAHw11XUHnwxT6OR5x9Adm5llxlBhw6HGTU_Dsg" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "b0fac930-e5ad-4ab7-9d93-2f2ab647584b",
    "url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b",
    "created_at": "2015-03-18T22:52:40Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "6cec7a73-a9b3-4c69-b740-95437327d92c",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/6cec7a73-a9b3-4c69-b740-95437327d92c",
    "developers_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/developers",
    "managers_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/managers",
    "auditors_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/auditors",
    "apps_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/apps",
    "routes_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/routes",
    "domains_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/domains",
    "service_instances_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/service_instances",
    "app_events_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/app_events",
    "events_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/events",
    "security_groups_url": "/v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/b0fac930-e5ad-4ab7-9d93-2f2ab647584b
X-VCAP-Request-ID: 0b28231c-6fb4-40c7-9805-30874b7cc8b9
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 11
guid af48e5a2-b45a-47c3-bce5-3f09df851442
created_at 2015-03-18 22:52:40 UTC
updated_at
timestamp 2015-03-18 22:52:40 UTC
type audit.space.create
actor uaa-id-108
actor_type user
actee b0fac930-e5ad-4ab7-9d93-2f2ab647584b
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "6cec7a73-a9b3-4c69-b740-95437327d92c"
  }
}
space_id 21
organization_guid 6cec7a73-a9b3-4c69-b740-95437327d92c
space_guid b0fac930-e5ad-4ab7-9d93-2f2ab647584b
actor_name email-70@somedomain.com
actee_name development