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-99e6bb7a-7824-48e4-b656-96970ffd7318
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": "fa168bc4-5466-49d1-bdfb-7d86efcc79c7"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExMCIsImVtYWlsIjoiZW1haWwtNzRAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2MTM3NDYyN30.1ghKRj7Ag1AcDiDLIjqGTaZNPDe2gD451wZV7PAZjYw
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": "fa168bc4-5466-49d1-bdfb-7d86efcc79c7"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExMCIsImVtYWlsIjoiZW1haWwtNzRAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2MTM3NDYyN30.1ghKRj7Ag1AcDiDLIjqGTaZNPDe2gD451wZV7PAZjYw" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "6591fa93-5f9b-43f8-afe8-10cedb74d3fa",
    "url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa",
    "created_at": "2016-04-16T01:23:47Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "fa168bc4-5466-49d1-bdfb-7d86efcc79c7",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/fa168bc4-5466-49d1-bdfb-7d86efcc79c7",
    "developers_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/developers",
    "managers_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/managers",
    "auditors_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/auditors",
    "apps_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/apps",
    "routes_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/routes",
    "domains_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/domains",
    "service_instances_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/service_instances",
    "app_events_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/app_events",
    "events_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/events",
    "security_groups_url": "/v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/6591fa93-5f9b-43f8-afe8-10cedb74d3fa
X-VCAP-Request-ID: 123874ab-4b9b-4be9-83f4-d2e9dfbfe7f5
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 11
guid b6653bd9-06de-45af-aaf6-710831760516
created_at 2016-04-16 01:23:47 UTC
updated_at
timestamp 2016-04-16 01:23:47 UTC
type audit.space.create
actor uaa-id-110
actor_type user
actee 6591fa93-5f9b-43f8-afe8-10cedb74d3fa
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "fa168bc4-5466-49d1-bdfb-7d86efcc79c7",
    "allow_ssh": true
  }
}
space_id
organization_guid fa168bc4-5466-49d1-bdfb-7d86efcc79c7
space_guid 6591fa93-5f9b-43f8-afe8-10cedb74d3fa
actor_name email-74@somedomain.com
actee_name development