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-8c17e9b7-1be3-46db-b9bf-59b20ea3849c
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
{
  "name": "development",
  "organization_guid": "a63fbe86-c0d0-4f86-b347-e09d21c2b573"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwMSIsImVtYWlsIjoiZW1haWwtODBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQyNjYzMzkwMH0.v3mVqN5CYym53Eu3PWArQSv__Yg8n7OHE62huSFqutY
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": "a63fbe86-c0d0-4f86-b347-e09d21c2b573"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwMSIsImVtYWlsIjoiZW1haWwtODBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQyNjYzMzkwMH0.v3mVqN5CYym53Eu3PWArQSv__Yg8n7OHE62huSFqutY" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "ce616b39-51e5-477e-9d14-2b197410a483",
    "url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483",
    "created_at": "2015-03-10T23:11:40Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "a63fbe86-c0d0-4f86-b347-e09d21c2b573",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/a63fbe86-c0d0-4f86-b347-e09d21c2b573",
    "developers_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/developers",
    "managers_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/managers",
    "auditors_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/auditors",
    "apps_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/apps",
    "routes_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/routes",
    "domains_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/domains",
    "service_instances_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/service_instances",
    "app_events_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/app_events",
    "events_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/events",
    "security_groups_url": "/v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/ce616b39-51e5-477e-9d14-2b197410a483
X-VCAP-Request-ID: 31df8405-aa14-4bcd-8fff-78239841ff09
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 25
guid 1e6836c2-d25b-4577-9385-6eeeb277080b
created_at 2015-03-10 23:11:40 UTC
updated_at
timestamp 2015-03-10 23:11:40 UTC
type audit.space.create
actor uaa-id-101
actor_type user
actee ce616b39-51e5-477e-9d14-2b197410a483
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "a63fbe86-c0d0-4f86-b347-e09d21c2b573"
  }
}
space_id 65
organization_guid a63fbe86-c0d0-4f86-b347-e09d21c2b573
space_guid ce616b39-51e5-477e-9d14-2b197410a483
actor_name email-80@somedomain.com
actee_name development