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-41ebbf92-8ba3-472f-aa28-fca1f719aee0
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": "dc01b0a0-e161-4603-a538-92488fa110f5"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTcwIiwiZW1haWwiOiJlbWFpbC01MUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI3NDgwODQzfQ.g46JU5p6FXdUjiCSIrVd_Vibx7yRxU9fCRGJQ0wcF7U
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": "dc01b0a0-e161-4603-a538-92488fa110f5"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTcwIiwiZW1haWwiOiJlbWFpbC01MUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI3NDgwODQzfQ.g46JU5p6FXdUjiCSIrVd_Vibx7yRxU9fCRGJQ0wcF7U" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "71c37d7d-ee17-4754-989b-d1229fab7d58",
    "url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58",
    "created_at": "2015-03-20T18:27:23Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "dc01b0a0-e161-4603-a538-92488fa110f5",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/dc01b0a0-e161-4603-a538-92488fa110f5",
    "developers_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/developers",
    "managers_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/managers",
    "auditors_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/auditors",
    "apps_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/apps",
    "routes_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/routes",
    "domains_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/domains",
    "service_instances_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/service_instances",
    "app_events_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/app_events",
    "events_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/events",
    "security_groups_url": "/v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/71c37d7d-ee17-4754-989b-d1229fab7d58
X-VCAP-Request-ID: d7f05f98-e325-45a4-83e6-3f637b57c34f
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 5
guid ad02c11a-56fc-4761-9f8d-43946c030376
created_at 2015-03-20 18:27:23 UTC
updated_at
timestamp 2015-03-20 18:27:23 UTC
type audit.space.create
actor uaa-id-70
actor_type user
actee 71c37d7d-ee17-4754-989b-d1229fab7d58
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "dc01b0a0-e161-4603-a538-92488fa110f5"
  }
}
space_id 28
organization_guid dc01b0a0-e161-4603-a538-92488fa110f5
space_guid 71c37d7d-ee17-4754-989b-d1229fab7d58
actor_name email-51@somedomain.com
actee_name development