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-420efa40-f0c4-406b-8946-df62bb360c25
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": "6fe6f39e-10e2-4979-babf-f693daceef5d"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE4NyIsImVtYWlsIjoiZW1haWwtMTI2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg4NTU2NzR9.CtQ_qRbvCNLoCeO0NQEZY50fZMUl4Ydq_sZRY5zfiPA
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": "6fe6f39e-10e2-4979-babf-f693daceef5d"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE4NyIsImVtYWlsIjoiZW1haWwtMTI2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg4NTU2NzR9.CtQ_qRbvCNLoCeO0NQEZY50fZMUl4Ydq_sZRY5zfiPA" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "39ad8e66-2d14-4871-ac73-a2adea6c04b2",
    "url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2",
    "created_at": "2016-03-17T21:41:14Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "6fe6f39e-10e2-4979-babf-f693daceef5d",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/6fe6f39e-10e2-4979-babf-f693daceef5d",
    "developers_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/developers",
    "managers_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/managers",
    "auditors_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/auditors",
    "apps_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/apps",
    "routes_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/routes",
    "domains_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/domains",
    "service_instances_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/service_instances",
    "app_events_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/app_events",
    "events_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/events",
    "security_groups_url": "/v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/39ad8e66-2d14-4871-ac73-a2adea6c04b2
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 19
guid e4d53127-5be3-4821-89d5-9a03c778bccf
created_at 2016-03-17 21:41:14 UTC
updated_at
timestamp 2016-03-17 21:41:14 UTC
type audit.space.create
actor uaa-id-187
actor_type user
actee 39ad8e66-2d14-4871-ac73-a2adea6c04b2
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "6fe6f39e-10e2-4979-babf-f693daceef5d",
    "allow_ssh": true
  }
}
space_id
organization_guid 6fe6f39e-10e2-4979-babf-f693daceef5d
space_guid 39ad8e66-2d14-4871-ac73-a2adea6c04b2
actor_name email-126@somedomain.com
actee_name development