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-a9abafad-2272-401b-9349-96e5f804395a
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": "9d42404c-36b6-41cf-840f-245db90bec1e"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTUxIiwiZW1haWwiOiJlbWFpbC01MUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI5MDM4NzAwfQ.vUFSilqSVD0oFvO56S2T80RTgtqukmOmERhRW8IKSb0
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": "9d42404c-36b6-41cf-840f-245db90bec1e"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTUxIiwiZW1haWwiOiJlbWFpbC01MUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI5MDM4NzAwfQ.vUFSilqSVD0oFvO56S2T80RTgtqukmOmERhRW8IKSb0" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "cae44dbe-67fc-4bb8-ba76-4857b873ffd6",
    "url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6",
    "created_at": "2015-04-07T19:11:40Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "9d42404c-36b6-41cf-840f-245db90bec1e",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/9d42404c-36b6-41cf-840f-245db90bec1e",
    "developers_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/developers",
    "managers_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/managers",
    "auditors_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/auditors",
    "apps_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/apps",
    "routes_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/routes",
    "domains_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/domains",
    "service_instances_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/service_instances",
    "app_events_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/app_events",
    "events_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/events",
    "security_groups_url": "/v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/cae44dbe-67fc-4bb8-ba76-4857b873ffd6
X-VCAP-Request-ID: 04c13a0e-4b1a-410c-8e24-8ecd2c5ad8b4
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 251f0288-0f10-42a5-a700-d840ab87fa8e
created_at 2015-04-07 19:11:40 UTC
updated_at
timestamp 2015-04-07 19:11:40 UTC
type audit.space.create
actor uaa-id-51
actor_type user
actee cae44dbe-67fc-4bb8-ba76-4857b873ffd6
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "9d42404c-36b6-41cf-840f-245db90bec1e"
  }
}
space_id 24
organization_guid 9d42404c-36b6-41cf-840f-245db90bec1e
space_guid cae44dbe-67fc-4bb8-ba76-4857b873ffd6
actor_name email-51@somedomain.com
actee_name development