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-fe86a287-de86-4186-bb72-98f9ec8a537a
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": "880df241-7cf9-434a-a594-c23b81e6ddf7"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwNSIsImVtYWlsIjoiZW1haWwtMjE1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0Mzk0MjYyMDl9.4Br85dUp_zGgu_n2UQ8zeim9UMsbHGlt-509FeFA7II
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": "880df241-7cf9-434a-a594-c23b81e6ddf7"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwNSIsImVtYWlsIjoiZW1haWwtMjE1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0Mzk0MjYyMDl9.4Br85dUp_zGgu_n2UQ8zeim9UMsbHGlt-509FeFA7II" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "f4af02bd-e71e-465f-a42e-7c7959602841",
    "url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841",
    "created_at": "2015-08-06T00:36:49Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "880df241-7cf9-434a-a594-c23b81e6ddf7",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/880df241-7cf9-434a-a594-c23b81e6ddf7",
    "developers_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/developers",
    "managers_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/managers",
    "auditors_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/auditors",
    "apps_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/apps",
    "routes_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/routes",
    "domains_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/domains",
    "service_instances_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/service_instances",
    "app_events_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/app_events",
    "events_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/events",
    "security_groups_url": "/v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/f4af02bd-e71e-465f-a42e-7c7959602841
X-VCAP-Request-ID: 336dcbdf-f059-4d7f-94fd-5107e6350c7b
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 17
guid b403d38d-1c19-479b-ab94-817b38aeeb1a
created_at 2015-08-06 00:36:49 UTC
updated_at
timestamp 2015-08-06 00:36:49 UTC
type audit.space.create
actor uaa-id-305
actor_type user
actee f4af02bd-e71e-465f-a42e-7c7959602841
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "880df241-7cf9-434a-a594-c23b81e6ddf7",
    "allow_ssh": true
  }
}
space_id
organization_guid 880df241-7cf9-434a-a594-c23b81e6ddf7
space_guid f4af02bd-e71e-465f-a42e-7c7959602841
actor_name email-215@somedomain.com
actee_name development