Home
Version 3
Spaces API

Spaces API

Creating a Space

POST /v2/spaces/

Fields

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-02552c62-0bc9-4832-b183-a7011e657567
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

Request

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMyOSIsImVtYWlsIjoiZW1haWwtMjUwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjI5OTA4ODR9._CL2F5-OA4ImTSQVpmlprfKCXw7MWbMwYfhWfvS6e9k
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "8c87040b-9773-41f4-9dd7-18f0f1a552bb"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "8c87040b-9773-41f4-9dd7-18f0f1a552bb"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMyOSIsImVtYWlsIjoiZW1haWwtMjUwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjI5OTA4ODR9._CL2F5-OA4ImTSQVpmlprfKCXw7MWbMwYfhWfvS6e9k" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17
X-VCAP-Request-ID: 60f6052b-00ff-4c47-a15d-850e649519f5
Content-Length: 1257
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "21ff16a6-c682-47c9-8921-bd153e7ccd17",
    "url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17",
    "created_at": "2015-01-27T19:14:44Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "8c87040b-9773-41f4-9dd7-18f0f1a552bb",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/8c87040b-9773-41f4-9dd7-18f0f1a552bb",
    "developers_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/developers",
    "managers_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/managers",
    "auditors_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/auditors",
    "apps_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/apps",
    "routes_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/routes",
    "domains_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/domains",
    "service_instances_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/service_instances",
    "app_events_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/app_events",
    "events_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/events",
    "security_groups_url": "/v2/spaces/21ff16a6-c682-47c9-8921-bd153e7ccd17/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 27
guid 3a05cc55-7933-4abe-a311-0af96a4447a9
created_at 2015-01-27 19:14:44 UTC
updated_at
timestamp 2015-01-27 19:14:44 UTC
type audit.space.create
actor uaa-id-329
actor_type user
actee 21ff16a6-c682-47c9-8921-bd153e7ccd17
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "8c87040b-9773-41f4-9dd7-18f0f1a552bb"
  }
}
space_id 97
organization_guid 8c87040b-9773-41f4-9dd7-18f0f1a552bb
space_guid 21ff16a6-c682-47c9-8921-bd153e7ccd17
actor_name email-250@somedomain.com
actee_name development