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-b7dde662-109c-4b51-a730-64167cbd1320
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.eyJ1c2VyX2lkIjoidWFhLWlkLTY1IiwiZW1haWwiOiJlbWFpbC00NkBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDE5OTg5OTYzfQ.NUPjfoSJmvyxdI-IbeEfrVocWYJH_OmO988NUADulsM
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "03707665-627e-40c7-bdea-eb3400d7625d"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "03707665-627e-40c7-bdea-eb3400d7625d"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTY1IiwiZW1haWwiOiJlbWFpbC00NkBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDE5OTg5OTYzfQ.NUPjfoSJmvyxdI-IbeEfrVocWYJH_OmO988NUADulsM" \
	-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/7541df78-f8c6-42ab-96f7-90826ec9e33c
X-VCAP-Request-ID: cef7afb3-46b7-481b-8d43-a7fa42fcc884
Content-Length: 1262
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "7541df78-f8c6-42ab-96f7-90826ec9e33c",
    "url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c",
    "created_at": "2014-12-24T01:39:23+00:00",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "03707665-627e-40c7-bdea-eb3400d7625d",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/03707665-627e-40c7-bdea-eb3400d7625d",
    "developers_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/developers",
    "managers_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/managers",
    "auditors_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/auditors",
    "apps_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/apps",
    "routes_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/routes",
    "domains_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/domains",
    "service_instances_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/service_instances",
    "app_events_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/app_events",
    "events_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/events",
    "security_groups_url": "/v2/spaces/7541df78-f8c6-42ab-96f7-90826ec9e33c/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 14
guid 4c31ec70-bb94-4951-a15d-5b81299659f3
created_at 2014-12-24 01:39:23 +0000
updated_at
timestamp 2014-12-24 01:39:23 +0000
type audit.space.create
actor uaa-id-65
actor_type user
actee 7541df78-f8c6-42ab-96f7-90826ec9e33c
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "03707665-627e-40c7-bdea-eb3400d7625d"
  }
}
space_id 29
organization_guid 03707665-627e-40c7-bdea-eb3400d7625d
space_guid 7541df78-f8c6-42ab-96f7-90826ec9e33c
actor_name email-46@somedomain.com
actee_name development