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-967d0bb8-c3e6-4b0b-970e-37c937706088
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": "a1bad0ec-5c37-40f1-ad1c-273f9abb66d1"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwIiwiZW1haWwiOiJlbWFpbC0xMEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ1MzYyMjk1fQ.KHW4MXudCxiRLklhfu08ceu6b3TcYH4GAApSDrhu1HY
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": "a1bad0ec-5c37-40f1-ad1c-273f9abb66d1"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwIiwiZW1haWwiOiJlbWFpbC0xMEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ1MzYyMjk1fQ.KHW4MXudCxiRLklhfu08ceu6b3TcYH4GAApSDrhu1HY" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "fe46fcef-65d9-40ec-b733-1263e87550fa",
    "url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa",
    "created_at": "2015-10-13T17:31:35Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "a1bad0ec-5c37-40f1-ad1c-273f9abb66d1",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/a1bad0ec-5c37-40f1-ad1c-273f9abb66d1",
    "developers_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/developers",
    "managers_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/managers",
    "auditors_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/auditors",
    "apps_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/apps",
    "routes_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/routes",
    "domains_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/domains",
    "service_instances_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/service_instances",
    "app_events_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/app_events",
    "events_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/events",
    "security_groups_url": "/v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/fe46fcef-65d9-40ec-b733-1263e87550fa
X-VCAP-Request-ID: 96ecc175-4195-4c9a-9121-df17e241fbab
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 4
guid cff346dc-4e2c-40b3-9b9b-3d70281cf843
created_at 2015-10-13 17:31:35 UTC
updated_at
timestamp 2015-10-13 17:31:35 UTC
type audit.space.create
actor uaa-id-10
actor_type user
actee fe46fcef-65d9-40ec-b733-1263e87550fa
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "a1bad0ec-5c37-40f1-ad1c-273f9abb66d1",
    "allow_ssh": true
  }
}
space_id
organization_guid a1bad0ec-5c37-40f1-ad1c-273f9abb66d1
space_guid fe46fcef-65d9-40ec-b733-1263e87550fa
actor_name email-10@somedomain.com
actee_name development