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-2bcedc4b-b32a-4507-acb0-6dcc936362c9
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 The guid of the associated space quota definition

Request

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNiIsImVtYWlsIjoiZW1haWwtMTYwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTY1MjY3MDZ9.9vCu-8SUZ5O3xe7Hpqj7vxBkGBSs8Qp1uGFLQJifb00
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "fcf0f5ec-ef37-4e51-9686-49df0a0b5824"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "fcf0f5ec-ef37-4e51-9686-49df0a0b5824"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNiIsImVtYWlsIjoiZW1haWwtMTYwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTY1MjY3MDZ9.9vCu-8SUZ5O3xe7Hpqj7vxBkGBSs8Qp1uGFLQJifb00" \
	-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/662ddcab-e712-4804-be50-2bee26d3405a
X-VCAP-Request-ID: c549075d-2705-4a0b-b440-2db19fc27c02
Content-Length: 1262
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "662ddcab-e712-4804-be50-2bee26d3405a",
    "url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a",
    "created_at": "2014-11-13T23:38:26+00:00",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "fcf0f5ec-ef37-4e51-9686-49df0a0b5824",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/fcf0f5ec-ef37-4e51-9686-49df0a0b5824",
    "developers_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/developers",
    "managers_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/managers",
    "auditors_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/auditors",
    "apps_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/apps",
    "routes_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/routes",
    "domains_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/domains",
    "service_instances_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/service_instances",
    "app_events_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/app_events",
    "events_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/events",
    "security_groups_url": "/v2/spaces/662ddcab-e712-4804-be50-2bee26d3405a/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 3
guid 3a8bdd44-0269-488d-86c9-2c2db9c6bcfc
created_at 2014-11-13 23:38:26 +0000
updated_at
timestamp 2014-11-13 23:38:26 +0000
type audit.space.create
actor uaa-id-216
actor_type user
actee 662ddcab-e712-4804-be50-2bee26d3405a
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "fcf0f5ec-ef37-4e51-9686-49df0a0b5824"
  }
}
space_id 51
organization_guid fcf0f5ec-ef37-4e51-9686-49df0a0b5824
space_guid 662ddcab-e712-4804-be50-2bee26d3405a
actor_name email-160@somedomain.com
actee_name development