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-d737aae5-28e9-44e2-87fe-58a85616af9c
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": "6a520185-71cc-4a4f-a362-6e5f54dd2cbd"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTkiLCJlbWFpbCI6ImVtYWlsLTlAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1NDQ1MTYwNn0.Ol39JUSqdRqCMe_Khs4dqFzxt8N1iRWuM_8ePrqTEw4
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": "6a520185-71cc-4a4f-a362-6e5f54dd2cbd"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTkiLCJlbWFpbCI6ImVtYWlsLTlAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1NDQ1MTYwNn0.Ol39JUSqdRqCMe_Khs4dqFzxt8N1iRWuM_8ePrqTEw4" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "4708571b-2c6f-42ea-8f66-30bdc6a6093a",
    "url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a",
    "created_at": "2016-01-26T22:20:05Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "6a520185-71cc-4a4f-a362-6e5f54dd2cbd",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/6a520185-71cc-4a4f-a362-6e5f54dd2cbd",
    "developers_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/developers",
    "managers_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/managers",
    "auditors_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/auditors",
    "apps_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/apps",
    "routes_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/routes",
    "domains_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/domains",
    "service_instances_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/service_instances",
    "app_events_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/app_events",
    "events_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/events",
    "security_groups_url": "/v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/4708571b-2c6f-42ea-8f66-30bdc6a6093a
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 5
guid 9cf1563b-eb57-4727-85d1-a81605719b05
created_at 2016-01-26 22:20:05 UTC
updated_at
timestamp 2016-01-26 22:20:05 UTC
type audit.space.create
actor uaa-id-9
actor_type user
actee 4708571b-2c6f-42ea-8f66-30bdc6a6093a
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "6a520185-71cc-4a4f-a362-6e5f54dd2cbd",
    "allow_ssh": true
  }
}
space_id
organization_guid 6a520185-71cc-4a4f-a362-6e5f54dd2cbd
space_guid 4708571b-2c6f-42ea-8f66-30bdc6a6093a
actor_name email-9@somedomain.com
actee_name development