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-b7183e52-92d1-4c7e-b93d-ddbfff0cd94b
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": "22d5b4a4-c631-4f0d-8d20-716b730ff9ad"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIiLCJlbWFpbCI6ImVtYWlsLTJAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ0MjYwMTUyNX0.ffreWhPnX0Xc4cq9In0TE0KAUxyFGneh-oxsGyBGr-U
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": "22d5b4a4-c631-4f0d-8d20-716b730ff9ad"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIiLCJlbWFpbCI6ImVtYWlsLTJAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ0MjYwMTUyNX0.ffreWhPnX0Xc4cq9In0TE0KAUxyFGneh-oxsGyBGr-U" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "a53c2c54-8db8-42f1-a4c9-940c9d953ed6",
    "url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6",
    "created_at": "2015-09-11T18:38:45Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "22d5b4a4-c631-4f0d-8d20-716b730ff9ad",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/22d5b4a4-c631-4f0d-8d20-716b730ff9ad",
    "developers_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/developers",
    "managers_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/managers",
    "auditors_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/auditors",
    "apps_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/apps",
    "routes_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/routes",
    "domains_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/domains",
    "service_instances_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/service_instances",
    "app_events_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/app_events",
    "events_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/events",
    "security_groups_url": "/v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/a53c2c54-8db8-42f1-a4c9-940c9d953ed6
X-VCAP-Request-ID: fead5c1a-c81d-458e-bf54-5b60894def5f
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 2
guid 30e0b757-b50a-41fd-b03a-09130ff427c5
created_at 2015-09-11 18:38:45 UTC
updated_at
timestamp 2015-09-11 18:38:45 UTC
type audit.space.create
actor uaa-id-2
actor_type user
actee a53c2c54-8db8-42f1-a4c9-940c9d953ed6
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "22d5b4a4-c631-4f0d-8d20-716b730ff9ad",
    "allow_ssh": true
  }
}
space_id
organization_guid 22d5b4a4-c631-4f0d-8d20-716b730ff9ad
space_guid a53c2c54-8db8-42f1-a4c9-940c9d953ed6
actor_name email-2@somedomain.com
actee_name development