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-c1e67d20-8643-4789-9dc2-f46b93ade86e
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": "13d3ed13-80ed-43ee-8554-2bbb85cca531"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE0IiwiZW1haWwiOiJlbWFpbC0xNEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDUzMzEwOTcwfQ.ABAQ3pLUoZ3tYtXH-hj0cAgCyYfZRlbAL1L_VjEwQ4U
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": "13d3ed13-80ed-43ee-8554-2bbb85cca531"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE0IiwiZW1haWwiOiJlbWFpbC0xNEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDUzMzEwOTcwfQ.ABAQ3pLUoZ3tYtXH-hj0cAgCyYfZRlbAL1L_VjEwQ4U" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "33cc58f7-cc33-47ed-b327-8696aa5d6d52",
    "url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52",
    "created_at": "2016-01-13T17:29:30Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "13d3ed13-80ed-43ee-8554-2bbb85cca531",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/13d3ed13-80ed-43ee-8554-2bbb85cca531",
    "developers_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/developers",
    "managers_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/managers",
    "auditors_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/auditors",
    "apps_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/apps",
    "routes_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/routes",
    "domains_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/domains",
    "service_instances_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/service_instances",
    "app_events_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/app_events",
    "events_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/events",
    "security_groups_url": "/v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/33cc58f7-cc33-47ed-b327-8696aa5d6d52
X-VCAP-Request-ID: 
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 3
guid dc6eee09-523e-4497-ba97-ceb47fdb449b
created_at 2016-01-13 17:29:30 UTC
updated_at
timestamp 2016-01-13 17:29:30 UTC
type audit.space.create
actor uaa-id-14
actor_type user
actee 33cc58f7-cc33-47ed-b327-8696aa5d6d52
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "13d3ed13-80ed-43ee-8554-2bbb85cca531",
    "allow_ssh": true
  }
}
space_id
organization_guid 13d3ed13-80ed-43ee-8554-2bbb85cca531
space_guid 33cc58f7-cc33-47ed-b327-8696aa5d6d52
actor_name email-14@somedomain.com
actee_name development