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-b2f0f619-6ee0-486b-a2c9-1b5b57c5b00f
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": "6be18947-1044-449e-949b-929655360dd0"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MyIsImVtYWlsIjoiZW1haWwtMTkxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjA1MDY2NTJ9.B5kx63UfpOtEqR60JcA5mtvVz2WBvLmWOGtWtv71Dlk
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": "6be18947-1044-449e-949b-929655360dd0"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MyIsImVtYWlsIjoiZW1haWwtMTkxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjA1MDY2NTJ9.B5kx63UfpOtEqR60JcA5mtvVz2WBvLmWOGtWtv71Dlk" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "ed5b717b-cc49-4712-be50-fdeb14a4b3ed",
    "url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed",
    "created_at": "2016-04-06T00:17:32Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "6be18947-1044-449e-949b-929655360dd0",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/6be18947-1044-449e-949b-929655360dd0",
    "developers_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/developers",
    "managers_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/managers",
    "auditors_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/auditors",
    "apps_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/apps",
    "routes_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/routes",
    "domains_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/domains",
    "service_instances_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/service_instances",
    "app_events_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/app_events",
    "events_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/events",
    "security_groups_url": "/v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/ed5b717b-cc49-4712-be50-fdeb14a4b3ed
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 35
guid 04742124-f664-4a7f-ad38-a49fbc8b8e05
created_at 2016-04-06 00:17:32 UTC
updated_at
timestamp 2016-04-06 00:17:32 UTC
type audit.space.create
actor uaa-id-283
actor_type user
actee ed5b717b-cc49-4712-be50-fdeb14a4b3ed
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "6be18947-1044-449e-949b-929655360dd0",
    "allow_ssh": true
  }
}
space_id
organization_guid 6be18947-1044-449e-949b-929655360dd0
space_guid ed5b717b-cc49-4712-be50-fdeb14a4b3ed
actor_name email-191@somedomain.com
actee_name development