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-dc82a896-1404-4f04-adde-623fb9ee86dc
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": "b258a656-78b8-48e5-9850-bb1dfc226d89"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTg0IiwiZW1haWwiOiJlbWFpbC00OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ0MjYwNjM5fQ.fU6aRC9bBb0nSxSmvPxTwHJpsvcUMu467ZhA7y8TDLk
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": "b258a656-78b8-48e5-9850-bb1dfc226d89"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTg0IiwiZW1haWwiOiJlbWFpbC00OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ0MjYwNjM5fQ.fU6aRC9bBb0nSxSmvPxTwHJpsvcUMu467ZhA7y8TDLk" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "bdbbceed-ebc9-429c-bb40-8723b3e7628d",
    "url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d",
    "created_at": "2015-09-30T23:30:39Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "b258a656-78b8-48e5-9850-bb1dfc226d89",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/b258a656-78b8-48e5-9850-bb1dfc226d89",
    "developers_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/developers",
    "managers_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/managers",
    "auditors_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/auditors",
    "apps_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/apps",
    "routes_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/routes",
    "domains_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/domains",
    "service_instances_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/service_instances",
    "app_events_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/app_events",
    "events_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/events",
    "security_groups_url": "/v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/bdbbceed-ebc9-429c-bb40-8723b3e7628d
X-VCAP-Request-ID: 8775fa31-4c21-4c56-88a6-085d7a7fb9ae
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 3
guid a3c0f75d-504b-4539-ae26-ae2c014f18d2
created_at 2015-09-30 23:30:39 UTC
updated_at
timestamp 2015-09-30 23:30:39 UTC
type audit.space.create
actor uaa-id-84
actor_type user
actee bdbbceed-ebc9-429c-bb40-8723b3e7628d
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "b258a656-78b8-48e5-9850-bb1dfc226d89",
    "allow_ssh": true
  }
}
space_id
organization_guid b258a656-78b8-48e5-9850-bb1dfc226d89
space_guid bdbbceed-ebc9-429c-bb40-8723b3e7628d
actor_name email-49@somedomain.com
actee_name development