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-bbcf771d-0f6d-4728-bfdd-971acc205a39
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.eyJ1c2VyX2lkIjoidWFhLWlkLTI0NiIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjQxMzczNzF9.845PR_hj6hI8LW0BHiNZV-4OYxmr4a5jcr00wp6Glqw
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "c0c02048-2c79-40d1-bab0-9c2640079104"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "c0c02048-2c79-40d1-bab0-9c2640079104"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0NiIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjQxMzczNzF9.845PR_hj6hI8LW0BHiNZV-4OYxmr4a5jcr00wp6Glqw" \
	-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/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3
X-VCAP-Request-ID: 66ce33a2-7c94-4048-b983-12257defbdc1
Content-Length: 1257
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "e3b01f41-6af8-4ccf-8165-4bffce9ae2b3",
    "url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3",
    "created_at": "2015-02-10T01:42:51Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "c0c02048-2c79-40d1-bab0-9c2640079104",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/c0c02048-2c79-40d1-bab0-9c2640079104",
    "developers_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/developers",
    "managers_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/managers",
    "auditors_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/auditors",
    "apps_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/apps",
    "routes_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/routes",
    "domains_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/domains",
    "service_instances_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/service_instances",
    "app_events_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/app_events",
    "events_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/events",
    "security_groups_url": "/v2/spaces/e3b01f41-6af8-4ccf-8165-4bffce9ae2b3/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 142
guid 8bf5469c-72b0-403a-9f5a-630abe9d047a
created_at 2015-02-10 01:42:51 UTC
updated_at
timestamp 2015-02-10 01:42:51 UTC
type audit.space.create
actor uaa-id-246
actor_type user
actee e3b01f41-6af8-4ccf-8165-4bffce9ae2b3
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "c0c02048-2c79-40d1-bab0-9c2640079104"
  }
}
space_id 199
organization_guid c0c02048-2c79-40d1-bab0-9c2640079104
space_guid e3b01f41-6af8-4ccf-8165-4bffce9ae2b3
actor_name email-168@somedomain.com
actee_name development