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-fed02273-5b49-485d-9c97-200bbea0d742
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": "ca8a7fb0-737a-4fe9-8b28-42b064981abe"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEyNiIsImVtYWlsIjoiZW1haWwtMTI1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzIzMTM2MTR9.CDRjLpeNTT0XgKdVeQ00_uby6RPd5meewSRQOHlGbUI
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": "ca8a7fb0-737a-4fe9-8b28-42b064981abe"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEyNiIsImVtYWlsIjoiZW1haWwtMTI1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzIzMTM2MTR9.CDRjLpeNTT0XgKdVeQ00_uby6RPd5meewSRQOHlGbUI" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "da840d5b-7987-4c6e-8c3c-b0ebead3b4ed",
    "url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed",
    "created_at": "2015-05-15T16:53:34Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "ca8a7fb0-737a-4fe9-8b28-42b064981abe",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/ca8a7fb0-737a-4fe9-8b28-42b064981abe",
    "developers_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/developers",
    "managers_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/managers",
    "auditors_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/auditors",
    "apps_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/apps",
    "routes_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/routes",
    "domains_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/domains",
    "service_instances_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/service_instances",
    "app_events_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/app_events",
    "events_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/events",
    "security_groups_url": "/v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/da840d5b-7987-4c6e-8c3c-b0ebead3b4ed
X-VCAP-Request-ID: 0e37234a-d300-412d-868f-41b02f6530e9
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 10
guid 1c68ecf2-aa87-4ab4-b813-4ee67ca66f83
created_at 2015-05-15 16:53:34 UTC
updated_at
timestamp 2015-05-15 16:53:34 UTC
type audit.space.create
actor uaa-id-126
actor_type user
actee da840d5b-7987-4c6e-8c3c-b0ebead3b4ed
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "ca8a7fb0-737a-4fe9-8b28-42b064981abe",
    "allow_ssh": true
  }
}
space_id 6
organization_guid ca8a7fb0-737a-4fe9-8b28-42b064981abe
space_guid da840d5b-7987-4c6e-8c3c-b0ebead3b4ed
actor_name email-125@somedomain.com
actee_name development