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-02974f2b-79db-483a-b048-2433e0c82df3
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": "ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MiIsImVtYWlsIjoiZW1haWwtMTc4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjM2MTg3MTh9.Do8kn2YMlN9aeIVZClnQcmUt8j3kxheIMaJhlQPvT0w
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": "ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MiIsImVtYWlsIjoiZW1haWwtMTc4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjM2MTg3MTh9.Do8kn2YMlN9aeIVZClnQcmUt8j3kxheIMaJhlQPvT0w" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "0730f8ac-07e9-4d61-9073-953fe127611f",
    "url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f",
    "created_at": "2016-05-12T00:45:18Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b",
    "developers_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/developers",
    "managers_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/managers",
    "auditors_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/auditors",
    "apps_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/apps",
    "routes_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/routes",
    "domains_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/domains",
    "service_instances_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/service_instances",
    "app_events_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/app_events",
    "events_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/events",
    "security_groups_url": "/v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/0730f8ac-07e9-4d61-9073-953fe127611f
X-VCAP-Request-ID: d1ad0891-aa44-44b8-8903-bb174df4ecc8
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 187
guid 6d2ee38c-f16b-4ad7-ba0d-faec2074c83e
created_at 2016-05-12 00:45:18 UTC
updated_at
timestamp 2016-05-12 00:45:18 UTC
type audit.space.create
actor uaa-id-282
actor_type user
actee 0730f8ac-07e9-4d61-9073-953fe127611f
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b",
    "allow_ssh": true
  }
}
space_id
organization_guid ccc80e9f-d4db-4f4e-9c55-f79ba1db9d8b
space_guid 0730f8ac-07e9-4d61-9073-953fe127611f
actor_name email-178@somedomain.com
actee_name development