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-90448425-7e71-4e93-9b56-d1319748cea8
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": "790f2f1d-e408-409c-9a6b-4fd4624e938c"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxIiwiZW1haWwiOiJlbWFpbC0yMUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ0NzgyOTIwfQ.XNPh9_ApYg_IIai_GjRGAbOpKZb1hz4KMP63peY4roE
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": "790f2f1d-e408-409c-9a6b-4fd4624e938c"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxIiwiZW1haWwiOiJlbWFpbC0yMUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ0NzgyOTIwfQ.XNPh9_ApYg_IIai_GjRGAbOpKZb1hz4KMP63peY4roE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "50159f0f-d803-4ce6-8cd5-20f43028fefc",
    "url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc",
    "created_at": "2015-10-07T00:35:20Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "790f2f1d-e408-409c-9a6b-4fd4624e938c",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/790f2f1d-e408-409c-9a6b-4fd4624e938c",
    "developers_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/developers",
    "managers_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/managers",
    "auditors_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/auditors",
    "apps_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/apps",
    "routes_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/routes",
    "domains_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/domains",
    "service_instances_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/service_instances",
    "app_events_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/app_events",
    "events_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/events",
    "security_groups_url": "/v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/50159f0f-d803-4ce6-8cd5-20f43028fefc
X-VCAP-Request-ID: b9e81b60-2d20-44eb-a125-363b1af87ba5
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 6
guid 8be275fa-a06e-4ec6-8e59-634dca1af7c1
created_at 2015-10-07 00:35:20 UTC
updated_at
timestamp 2015-10-07 00:35:20 UTC
type audit.space.create
actor uaa-id-21
actor_type user
actee 50159f0f-d803-4ce6-8cd5-20f43028fefc
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "790f2f1d-e408-409c-9a6b-4fd4624e938c",
    "allow_ssh": true
  }
}
space_id
organization_guid 790f2f1d-e408-409c-9a6b-4fd4624e938c
space_guid 50159f0f-d803-4ce6-8cd5-20f43028fefc
actor_name email-21@somedomain.com
actee_name development