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-91ab55e3-d480-45b9-bcd2-4914520ed531
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.eyJ1c2VyX2lkIjoidWFhLWlkLTc0IiwiZW1haWwiOiJlbWFpbC01NUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI0NDcxNjg4fQ.h_EOALxhAZtwv66kWps7TdluvUkL-ejyRcbfRU-6hp4
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "16ae1c40-2f55-4629-b37c-93a03eb67100"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "16ae1c40-2f55-4629-b37c-93a03eb67100"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTc0IiwiZW1haWwiOiJlbWFpbC01NUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDI0NDcxNjg4fQ.h_EOALxhAZtwv66kWps7TdluvUkL-ejyRcbfRU-6hp4" \
	-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/2f91acde-0878-4491-b515-2121f3d5466a
X-VCAP-Request-ID: 7c5c214b-4016-4347-bab0-6af9cadc5e11
Content-Length: 1257
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "2f91acde-0878-4491-b515-2121f3d5466a",
    "url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a",
    "created_at": "2015-02-13T22:34:48Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "16ae1c40-2f55-4629-b37c-93a03eb67100",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/16ae1c40-2f55-4629-b37c-93a03eb67100",
    "developers_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/developers",
    "managers_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/managers",
    "auditors_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/auditors",
    "apps_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/apps",
    "routes_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/routes",
    "domains_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/domains",
    "service_instances_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/service_instances",
    "app_events_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/app_events",
    "events_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/events",
    "security_groups_url": "/v2/spaces/2f91acde-0878-4491-b515-2121f3d5466a/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 12
guid d6bf8449-d350-48a5-a0e4-68921ef144c9
created_at 2015-02-13 22:34:48 UTC
updated_at
timestamp 2015-02-13 22:34:48 UTC
type audit.space.create
actor uaa-id-74
actor_type user
actee 2f91acde-0878-4491-b515-2121f3d5466a
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "16ae1c40-2f55-4629-b37c-93a03eb67100"
  }
}
space_id 24
organization_guid 16ae1c40-2f55-4629-b37c-93a03eb67100
space_guid 2f91acde-0878-4491-b515-2121f3d5466a
actor_name email-55@somedomain.com
actee_name development