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-bc46123a-743f-43a2-bafe-df0b19389dfd
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": "c71ab020-28ba-43b2-b5e6-4db9a78199b0"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTczIiwiZW1haWwiOiJlbWFpbC00MEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ5NTMxNTA5fQ.eQwMsXpcdKtxZtlW509q7gTyvfN0Y4DlQEDPXt1JUIw
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": "c71ab020-28ba-43b2-b5e6-4db9a78199b0"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTczIiwiZW1haWwiOiJlbWFpbC00MEBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ5NTMxNTA5fQ.eQwMsXpcdKtxZtlW509q7gTyvfN0Y4DlQEDPXt1JUIw" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "2655045b-e98d-4e84-9ea6-1998a7c2408e",
    "url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e",
    "created_at": "2015-11-30T23:38:29Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "c71ab020-28ba-43b2-b5e6-4db9a78199b0",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/c71ab020-28ba-43b2-b5e6-4db9a78199b0",
    "developers_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/developers",
    "managers_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/managers",
    "auditors_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/auditors",
    "apps_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/apps",
    "routes_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/routes",
    "domains_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/domains",
    "service_instances_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/service_instances",
    "app_events_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/app_events",
    "events_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/events",
    "security_groups_url": "/v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/2655045b-e98d-4e84-9ea6-1998a7c2408e
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 17
guid 4e207981-61db-4bb3-82f0-09d7050cedf8
created_at 2015-11-30 23:38:29 UTC
updated_at
timestamp 2015-11-30 23:38:29 UTC
type audit.space.create
actor uaa-id-73
actor_type user
actee 2655045b-e98d-4e84-9ea6-1998a7c2408e
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "c71ab020-28ba-43b2-b5e6-4db9a78199b0",
    "allow_ssh": true
  }
}
space_id
organization_guid c71ab020-28ba-43b2-b5e6-4db9a78199b0
space_guid 2655045b-e98d-4e84-9ea6-1998a7c2408e
actor_name email-40@somedomain.com
actee_name development