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-468f4adb-55cd-4035-a28f-bc75b3e55f91
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": "2bc3555c-166f-4a7c-bc9b-c8eb5418fa65"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3NSIsImVtYWlsIjoiZW1haWwtMjcyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg1OTk0NDl9.3IIpNsYEjOdy78rk8hXiQvaganJYK4FiuhdoF77xO9I
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": "2bc3555c-166f-4a7c-bc9b-c8eb5418fa65"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3NSIsImVtYWlsIjoiZW1haWwtMjcyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg1OTk0NDl9.3IIpNsYEjOdy78rk8hXiQvaganJYK4FiuhdoF77xO9I" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "cf05874d-6fff-48fe-ab8a-73bfb99edf76",
    "url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76",
    "created_at": "2016-03-14T22:30:49Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "2bc3555c-166f-4a7c-bc9b-c8eb5418fa65",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/2bc3555c-166f-4a7c-bc9b-c8eb5418fa65",
    "developers_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/developers",
    "managers_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/managers",
    "auditors_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/auditors",
    "apps_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/apps",
    "routes_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/routes",
    "domains_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/domains",
    "service_instances_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/service_instances",
    "app_events_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/app_events",
    "events_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/events",
    "security_groups_url": "/v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/cf05874d-6fff-48fe-ab8a-73bfb99edf76
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 26
guid e3345b8a-d1bc-4318-910e-2c2ae790359f
created_at 2016-03-14 22:30:49 UTC
updated_at
timestamp 2016-03-14 22:30:49 UTC
type audit.space.create
actor uaa-id-375
actor_type user
actee cf05874d-6fff-48fe-ab8a-73bfb99edf76
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "2bc3555c-166f-4a7c-bc9b-c8eb5418fa65",
    "allow_ssh": true
  }
}
space_id
organization_guid 2bc3555c-166f-4a7c-bc9b-c8eb5418fa65
space_guid cf05874d-6fff-48fe-ab8a-73bfb99edf76
actor_name email-272@somedomain.com
actee_name development