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-14224511-9e33-423c-817b-d6ec4f3e178f
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.eyJ1c2VyX2lkIjoidWFhLWlkLTI3NCIsImVtYWlsIjoiZW1haWwtMjE0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjIzMjM1NTF9.9mx4H1mUWhD1zvlJbkOiz89I_4DPr5FM887OqYgaIqE
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "c7ceb34b-e824-4053-99ca-c2496ae77517"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "c7ceb34b-e824-4053-99ca-c2496ae77517"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI3NCIsImVtYWlsIjoiZW1haWwtMjE0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjIzMjM1NTF9.9mx4H1mUWhD1zvlJbkOiz89I_4DPr5FM887OqYgaIqE" \
	-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/488762f2-4f6f-44f8-a0c7-be29b0d47cbd
X-VCAP-Request-ID: 69e8c4bf-e9fb-45c7-8071-6d00132c1068
Content-Length: 1262
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "488762f2-4f6f-44f8-a0c7-be29b0d47cbd",
    "url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd",
    "created_at": "2015-01-20T01:52:31+00:00",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "c7ceb34b-e824-4053-99ca-c2496ae77517",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/c7ceb34b-e824-4053-99ca-c2496ae77517",
    "developers_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/developers",
    "managers_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/managers",
    "auditors_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/auditors",
    "apps_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/apps",
    "routes_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/routes",
    "domains_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/domains",
    "service_instances_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/service_instances",
    "app_events_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/app_events",
    "events_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/events",
    "security_groups_url": "/v2/spaces/488762f2-4f6f-44f8-a0c7-be29b0d47cbd/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 165
guid fcb8aa9b-b38e-47d2-b77c-f21acf078ed1
created_at 2015-01-20 01:52:31 +0000
updated_at
timestamp 2015-01-20 01:52:31 +0000
type audit.space.create
actor uaa-id-274
actor_type user
actee 488762f2-4f6f-44f8-a0c7-be29b0d47cbd
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "c7ceb34b-e824-4053-99ca-c2496ae77517"
  }
}
space_id 208
organization_guid c7ceb34b-e824-4053-99ca-c2496ae77517
space_guid 488762f2-4f6f-44f8-a0c7-be29b0d47cbd
actor_name email-214@somedomain.com
actee_name development