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-627cee22-3dee-46cb-ab0a-c317b60bb18d
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": "a53063a8-6db6-48e5-a3f2-8f32156a9aca"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI1MyIsImVtYWlsIjoiZW1haWwtMTg2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjYxODc3NTF9.ZJYenTg57wmKieHTi6OzG7IFzWh4zlpGjaSX7bz47Gc
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": "a53063a8-6db6-48e5-a3f2-8f32156a9aca"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI1MyIsImVtYWlsIjoiZW1haWwtMTg2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjYxODc3NTF9.ZJYenTg57wmKieHTi6OzG7IFzWh4zlpGjaSX7bz47Gc" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "b4ac4d0a-7afc-45ce-9123-b57313654cfa",
    "url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa",
    "created_at": "2015-03-05T19:15:51Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "a53063a8-6db6-48e5-a3f2-8f32156a9aca",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/a53063a8-6db6-48e5-a3f2-8f32156a9aca",
    "developers_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/developers",
    "managers_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/managers",
    "auditors_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/auditors",
    "apps_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/apps",
    "routes_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/routes",
    "domains_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/domains",
    "service_instances_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/service_instances",
    "app_events_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/app_events",
    "events_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/events",
    "security_groups_url": "/v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/b4ac4d0a-7afc-45ce-9123-b57313654cfa
X-VCAP-Request-ID: 39ddbe97-d927-48e7-ba76-5a6836065c78
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 18
guid 8f2007e1-225d-4f65-b933-8c15dc563b78
created_at 2015-03-05 19:15:51 UTC
updated_at
timestamp 2015-03-05 19:15:51 UTC
type audit.space.create
actor uaa-id-253
actor_type user
actee b4ac4d0a-7afc-45ce-9123-b57313654cfa
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "a53063a8-6db6-48e5-a3f2-8f32156a9aca"
  }
}
space_id 51
organization_guid a53063a8-6db6-48e5-a3f2-8f32156a9aca
space_guid b4ac4d0a-7afc-45ce-9123-b57313654cfa
actor_name email-186@somedomain.com
actee_name development