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-74b37125-cc09-4816-aca3-c366c786d85f
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": "178454f2-2f30-4c76-a5d7-37ff4ca9e011"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MCIsImVtYWlsIjoiZW1haWwtMjcwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTY0NTIyNDR9.VuU2ZLhu0qWmG1LkcZUvPY2EiT423KrObLwc3nRmbAA
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": "178454f2-2f30-4c76-a5d7-37ff4ca9e011"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MCIsImVtYWlsIjoiZW1haWwtMjcwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTY0NTIyNDR9.VuU2ZLhu0qWmG1LkcZUvPY2EiT423KrObLwc3nRmbAA" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "76a46456-1d5f-4b7f-9f8e-1616c9edb4f8",
    "url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8",
    "created_at": "2016-02-19T02:04:04Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "178454f2-2f30-4c76-a5d7-37ff4ca9e011",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/178454f2-2f30-4c76-a5d7-37ff4ca9e011",
    "developers_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/developers",
    "managers_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/managers",
    "auditors_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/auditors",
    "apps_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/apps",
    "routes_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/routes",
    "domains_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/domains",
    "service_instances_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/service_instances",
    "app_events_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/app_events",
    "events_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/events",
    "security_groups_url": "/v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/76a46456-1d5f-4b7f-9f8e-1616c9edb4f8
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 182
guid fcae21af-a39b-40ad-af57-2ae7a67ce235
created_at 2016-02-19 02:04:04 UTC
updated_at
timestamp 2016-02-19 02:04:04 UTC
type audit.space.create
actor uaa-id-370
actor_type user
actee 76a46456-1d5f-4b7f-9f8e-1616c9edb4f8
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "178454f2-2f30-4c76-a5d7-37ff4ca9e011",
    "allow_ssh": true
  }
}
space_id
organization_guid 178454f2-2f30-4c76-a5d7-37ff4ca9e011
space_guid 76a46456-1d5f-4b7f-9f8e-1616c9edb4f8
actor_name email-270@somedomain.com
actee_name development