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-d5d90373-0e3a-4d98-8bd8-953c8e2fd9eb
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": "29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMiLCJlbWFpbCI6ImVtYWlsLTNAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1MTQxMzY3NX0.AP-Db2rh2nLHM8XPJF-tY_D0N6ndtf0vUjHjFiYO32Y
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": "29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMiLCJlbWFpbCI6ImVtYWlsLTNAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1MTQxMzY3NX0.AP-Db2rh2nLHM8XPJF-tY_D0N6ndtf0vUjHjFiYO32Y" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "b86e18be-bb99-4c64-bf91-9347cab370b8",
    "url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8",
    "created_at": "2015-12-22T18:27:55Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba",
    "developers_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/developers",
    "managers_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/managers",
    "auditors_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/auditors",
    "apps_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/apps",
    "routes_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/routes",
    "domains_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/domains",
    "service_instances_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/service_instances",
    "app_events_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/app_events",
    "events_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/events",
    "security_groups_url": "/v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/b86e18be-bb99-4c64-bf91-9347cab370b8
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 1
guid 14db7233-4fd2-404d-bbac-6ba3b035cc8d
created_at 2015-12-22 18:27:55 UTC
updated_at
timestamp 2015-12-22 18:27:55 UTC
type audit.space.create
actor uaa-id-3
actor_type user
actee b86e18be-bb99-4c64-bf91-9347cab370b8
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba",
    "allow_ssh": true
  }
}
space_id
organization_guid 29d7b9ce-ed2f-4fd3-824d-bb58d679b7ba
space_guid b86e18be-bb99-4c64-bf91-9347cab370b8
actor_name email-3@somedomain.com
actee_name development