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-5853a9d7-6e31-4270-90dc-dbab82e7a0e4
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": "c77cee8f-6292-4413-bf4c-c5aea0fe3071"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNyIsImVtYWlsIjoiZW1haWwtMTgwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDcxMTY4NDJ9.Rx1WFxCAgCDHFNftM4VxgpVrpWAwV77L5tfbxKoX_yw
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": "c77cee8f-6292-4413-bf4c-c5aea0fe3071"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNyIsImVtYWlsIjoiZW1haWwtMTgwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDcxMTY4NDJ9.Rx1WFxCAgCDHFNftM4VxgpVrpWAwV77L5tfbxKoX_yw" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "c6f5bc2d-3117-48af-a076-42a95161a3ba",
    "url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba",
    "created_at": "2015-11-03T00:54:02Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "c77cee8f-6292-4413-bf4c-c5aea0fe3071",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/c77cee8f-6292-4413-bf4c-c5aea0fe3071",
    "developers_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/developers",
    "managers_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/managers",
    "auditors_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/auditors",
    "apps_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/apps",
    "routes_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/routes",
    "domains_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/domains",
    "service_instances_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/service_instances",
    "app_events_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/app_events",
    "events_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/events",
    "security_groups_url": "/v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/c6f5bc2d-3117-48af-a076-42a95161a3ba
X-VCAP-Request-ID: 68b25fa6-2770-4db8-9fb1-76556925b35b
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 42
guid 7a6dc009-7484-458a-8815-484558335fd8
created_at 2015-11-03 00:54:02 UTC
updated_at
timestamp 2015-11-03 00:54:02 UTC
type audit.space.create
actor uaa-id-217
actor_type user
actee c6f5bc2d-3117-48af-a076-42a95161a3ba
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "c77cee8f-6292-4413-bf4c-c5aea0fe3071",
    "allow_ssh": true
  }
}
space_id
organization_guid c77cee8f-6292-4413-bf4c-c5aea0fe3071
space_guid c6f5bc2d-3117-48af-a076-42a95161a3ba
actor_name email-180@somedomain.com
actee_name development