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-1c73b4b2-69b5-4e65-879f-f8da24df409d
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
allow_ssh Whether or not Space Developers can enable ssh on apps in the space
{
  "name": "development",
  "organization_guid": "c523070c-3006-4715-86dd-414afaecd949"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQ2IiwiZW1haWwiOiJlbWFpbC0yNkBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDM4NjQxNzg4fQ.bUVywQWR9aeybeoIE5f5C-ELZtKp-50yct5CRsVrkuM
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": "c523070c-3006-4715-86dd-414afaecd949"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQ2IiwiZW1haWwiOiJlbWFpbC0yNkBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDM4NjQxNzg4fQ.bUVywQWR9aeybeoIE5f5C-ELZtKp-50yct5CRsVrkuM" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "d29dc30c-793c-49a6-97fe-9aff75dcbd12",
    "url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12",
    "created_at": "2015-07-27T22:43:08Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "c523070c-3006-4715-86dd-414afaecd949",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/c523070c-3006-4715-86dd-414afaecd949",
    "developers_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/developers",
    "managers_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/managers",
    "auditors_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/auditors",
    "apps_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/apps",
    "routes_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/routes",
    "domains_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/domains",
    "service_instances_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/service_instances",
    "app_events_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/app_events",
    "events_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/events",
    "security_groups_url": "/v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/d29dc30c-793c-49a6-97fe-9aff75dcbd12
X-VCAP-Request-ID: 43c8c32a-22b9-44f9-b80a-61d5c3ef8a22
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 12
guid 2094760f-637a-4cff-a291-aed1eb68c482
created_at 2015-07-27 22:43:08 UTC
updated_at
timestamp 2015-07-27 22:43:08 UTC
type audit.space.create
actor uaa-id-46
actor_type user
actee d29dc30c-793c-49a6-97fe-9aff75dcbd12
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "c523070c-3006-4715-86dd-414afaecd949",
    "allow_ssh": true
  }
}
space_id
organization_guid c523070c-3006-4715-86dd-414afaecd949
space_guid d29dc30c-793c-49a6-97fe-9aff75dcbd12
actor_name email-26@somedomain.com
actee_name development