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-e82b267a-67ca-436c-9788-1048eeb49db4
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": "b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI1OCIsImVtYWlsIjoiZW1haWwtMTk0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTM4MzcyNzV9.1CswPWxkpxeoc7uzKEi2pig2pKnPQ9qGhUDbhAOmBj4
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": "b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI1OCIsImVtYWlsIjoiZW1haWwtMTk0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTM4MzcyNzV9.1CswPWxkpxeoc7uzKEi2pig2pKnPQ9qGhUDbhAOmBj4" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "65e486b5-a38a-49a9-8441-45cbbb188d20",
    "url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20",
    "created_at": "2016-01-19T19:41:15Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2",
    "developers_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/developers",
    "managers_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/managers",
    "auditors_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/auditors",
    "apps_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/apps",
    "routes_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/routes",
    "domains_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/domains",
    "service_instances_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/service_instances",
    "app_events_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/app_events",
    "events_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/events",
    "security_groups_url": "/v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/65e486b5-a38a-49a9-8441-45cbbb188d20
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 182
guid 6aefe557-db95-4102-ad75-38a2f3bc52f6
created_at 2016-01-19 19:41:15 UTC
updated_at
timestamp 2016-01-19 19:41:15 UTC
type audit.space.create
actor uaa-id-258
actor_type user
actee 65e486b5-a38a-49a9-8441-45cbbb188d20
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2",
    "allow_ssh": true
  }
}
space_id
organization_guid b3e9cd1f-fa64-46ee-bf57-33f4ad4136e2
space_guid 65e486b5-a38a-49a9-8441-45cbbb188d20
actor_name email-194@somedomain.com
actee_name development