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-357dc1d9-d65c-4173-ba4a-4e831e512aea
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": "2e1b240e-e7cb-4208-97f1-dc5c687649d9"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExOSIsImVtYWlsIjoiZW1haWwtNzBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQzNjgyOTc3OH0.Obukiu-MSjYrvH83QtRXkY6ion4dL2dkL77YEelNJg0
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": "2e1b240e-e7cb-4208-97f1-dc5c687649d9"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExOSIsImVtYWlsIjoiZW1haWwtNzBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQzNjgyOTc3OH0.Obukiu-MSjYrvH83QtRXkY6ion4dL2dkL77YEelNJg0" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "2d43285b-162b-49f3-963c-219175c891f4",
    "url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4",
    "created_at": "2015-07-06T23:22:58Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "2e1b240e-e7cb-4208-97f1-dc5c687649d9",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/2e1b240e-e7cb-4208-97f1-dc5c687649d9",
    "developers_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/developers",
    "managers_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/managers",
    "auditors_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/auditors",
    "apps_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/apps",
    "routes_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/routes",
    "domains_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/domains",
    "service_instances_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/service_instances",
    "app_events_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/app_events",
    "events_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/events",
    "security_groups_url": "/v2/spaces/2d43285b-162b-49f3-963c-219175c891f4/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/2d43285b-162b-49f3-963c-219175c891f4
X-VCAP-Request-ID: 2379be59-5f9e-4853-9dd2-414607aa5b9a
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 18
guid d2171955-48a3-428e-8c5e-9ebb4ad9f978
created_at 2015-07-06 23:22:58 UTC
updated_at
timestamp 2015-07-06 23:22:58 UTC
type audit.space.create
actor uaa-id-119
actor_type user
actee 2d43285b-162b-49f3-963c-219175c891f4
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "2e1b240e-e7cb-4208-97f1-dc5c687649d9",
    "allow_ssh": true
  }
}
organization_guid 2e1b240e-e7cb-4208-97f1-dc5c687649d9
space_guid 2d43285b-162b-49f3-963c-219175c891f4
actor_name email-70@somedomain.com
actee_name development