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-a7168894-84e1-475d-96c6-834f5a84bf8f
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": "39d1bb2c-bd05-433b-a80b-be02ef656b7e"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIzNCIsImVtYWlsIjoiZW1haWwtMTY2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjU5NDg2Njl9.cKduZAPyockq7oI0u8dERlxg0wBRVtlgrTsZJBpDIao
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": "39d1bb2c-bd05-433b-a80b-be02ef656b7e"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIzNCIsImVtYWlsIjoiZW1haWwtMTY2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjU5NDg2Njl9.cKduZAPyockq7oI0u8dERlxg0wBRVtlgrTsZJBpDIao" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "5aa6c40e-9d9c-4aab-8785-4707a0881d83",
    "url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83",
    "created_at": "2015-03-03T00:51:08Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "39d1bb2c-bd05-433b-a80b-be02ef656b7e",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/39d1bb2c-bd05-433b-a80b-be02ef656b7e",
    "developers_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/developers",
    "managers_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/managers",
    "auditors_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/auditors",
    "apps_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/apps",
    "routes_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/routes",
    "domains_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/domains",
    "service_instances_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/service_instances",
    "app_events_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/app_events",
    "events_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/events",
    "security_groups_url": "/v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/5aa6c40e-9d9c-4aab-8785-4707a0881d83
X-VCAP-Request-ID: 716d30a9-cd31-4fc6-bf3a-fb52a1150361
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 10
guid 44503e08-a13e-4c36-a8da-82bcbb1e0367
created_at 2015-03-03 00:51:08 UTC
updated_at
timestamp 2015-03-03 00:51:08 UTC
type audit.space.create
actor uaa-id-234
actor_type user
actee 5aa6c40e-9d9c-4aab-8785-4707a0881d83
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "39d1bb2c-bd05-433b-a80b-be02ef656b7e"
  }
}
space_id 43
organization_guid 39d1bb2c-bd05-433b-a80b-be02ef656b7e
space_guid 5aa6c40e-9d9c-4aab-8785-4707a0881d83
actor_name email-166@somedomain.com
actee_name development