Home
Version 3
Spaces API

Spaces API

Creating a Space

POST /v2/spaces/

Fields

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-b9b15edd-3e1e-4dce-b84b-64fdf54611f5
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

Request

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwMCIsImVtYWlsIjoiZW1haWwtMjI1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTc0NjIzNjh9.nLNUBt8HbhV0db8RO-NmtwGkUS1PR4tyBuX3froiEVA
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "90cae53c-f5ec-423d-ad7c-f90881775962"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "90cae53c-f5ec-423d-ad7c-f90881775962"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMwMCIsImVtYWlsIjoiZW1haWwtMjI1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTc0NjIzNjh9.nLNUBt8HbhV0db8RO-NmtwGkUS1PR4tyBuX3froiEVA" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c
X-VCAP-Request-ID: 30fba04b-8391-4259-b3fa-6f8e5dcd9872
Content-Length: 1262
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "21790710-cae4-4333-a46d-d3aaed019b2c",
    "url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c",
    "created_at": "2014-11-24T19:32:48+00:00",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "90cae53c-f5ec-423d-ad7c-f90881775962",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/90cae53c-f5ec-423d-ad7c-f90881775962",
    "developers_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/developers",
    "managers_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/managers",
    "auditors_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/auditors",
    "apps_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/apps",
    "routes_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/routes",
    "domains_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/domains",
    "service_instances_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/service_instances",
    "app_events_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/app_events",
    "events_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/events",
    "security_groups_url": "/v2/spaces/21790710-cae4-4333-a46d-d3aaed019b2c/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 10
guid d24f28dd-668e-4fc1-ab1d-dca02e3eee2a
created_at 2014-11-24 19:32:48 +0000
updated_at
timestamp 2014-11-24 19:32:48 +0000
type audit.space.create
actor uaa-id-300
actor_type user
actee 21790710-cae4-4333-a46d-d3aaed019b2c
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "90cae53c-f5ec-423d-ad7c-f90881775962"
  }
}
space_id 21
organization_guid 90cae53c-f5ec-423d-ad7c-f90881775962
space_guid 21790710-cae4-4333-a46d-d3aaed019b2c
actor_name email-225@somedomain.com
actee_name development