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-d5e74c12-6f6e-4268-be02-76c2ff76171f
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.eyJ1c2VyX2lkIjoidWFhLWlkLTE2MCIsImVtYWlsIjoiZW1haWwtMTIzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTU3NTQxMzh9.4TKPmbTT8LHWHkpTqPOdoEnMIH6X3KN-G8Lvr_PJbWY
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "08522c45-1d42-46f2-82d3-271e6aca1f38"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "08522c45-1d42-46f2-82d3-271e6aca1f38"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE2MCIsImVtYWlsIjoiZW1haWwtMTIzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTU3NTQxMzh9.4TKPmbTT8LHWHkpTqPOdoEnMIH6X3KN-G8Lvr_PJbWY" \
	-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/e126e2ca-404d-4ee1-9112-9b4d6cf15e45
X-VCAP-Request-ID: 4b525d4f-a1c9-4823-a8f6-625829ebd5d1
Content-Length: 1262
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "e126e2ca-404d-4ee1-9112-9b4d6cf15e45",
    "url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45",
    "created_at": "2014-11-05T01:02:18+00:00",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "08522c45-1d42-46f2-82d3-271e6aca1f38",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/08522c45-1d42-46f2-82d3-271e6aca1f38",
    "developers_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/developers",
    "managers_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/managers",
    "auditors_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/auditors",
    "apps_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/apps",
    "routes_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/routes",
    "domains_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/domains",
    "service_instances_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/service_instances",
    "app_events_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/app_events",
    "events_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/events",
    "security_groups_url": "/v2/spaces/e126e2ca-404d-4ee1-9112-9b4d6cf15e45/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 42
guid 5a591f38-78bb-4109-8bcd-4e7bc5a49845
created_at 2014-11-05 01:02:18 +0000
updated_at
timestamp 2014-11-05 01:02:18 +0000
type audit.space.create
actor uaa-id-160
actor_type user
actee e126e2ca-404d-4ee1-9112-9b4d6cf15e45
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "08522c45-1d42-46f2-82d3-271e6aca1f38"
  }
}
space_id 111
organization_guid 08522c45-1d42-46f2-82d3-271e6aca1f38
space_guid e126e2ca-404d-4ee1-9112-9b4d6cf15e45
actor_name email-123@somedomain.com
actee_name development