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-d3110c79-073b-4e8e-8396-ccbbda90e343
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.eyJ1c2VyX2lkIjoidWFhLWlkLTM1MCIsImVtYWlsIjoiZW1haWwtMjcxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjQzMTAxNDJ9.lo2r4Jb8VJbxrOrUGnDpwy00E4bxAloflQC-SL8qw4o
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

POST /v2/spaces

Body

{
  "name": "development",
  "organization_guid": "7e101853-c751-49c0-8d04-6de8899914b7"
}

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "7e101853-c751-49c0-8d04-6de8899914b7"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM1MCIsImVtYWlsIjoiZW1haWwtMjcxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MjQzMTAxNDJ9.lo2r4Jb8VJbxrOrUGnDpwy00E4bxAloflQC-SL8qw4o" \
	-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/e7888314-a0a5-446d-8e29-0d8521c19f49
X-VCAP-Request-ID: 740dfbb1-b392-42c7-88f2-dc8ca2e41967
Content-Length: 1257
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "e7888314-a0a5-446d-8e29-0d8521c19f49",
    "url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49",
    "created_at": "2015-02-12T01:42:22Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "7e101853-c751-49c0-8d04-6de8899914b7",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/7e101853-c751-49c0-8d04-6de8899914b7",
    "developers_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/developers",
    "managers_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/managers",
    "auditors_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/auditors",
    "apps_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/apps",
    "routes_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/routes",
    "domains_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/domains",
    "service_instances_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/service_instances",
    "app_events_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/app_events",
    "events_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/events",
    "security_groups_url": "/v2/spaces/e7888314-a0a5-446d-8e29-0d8521c19f49/security_groups"
  }
}

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 3
guid a6e5bf7e-0675-44ff-8611-c686155459bc
created_at 2015-02-12 01:42:22 UTC
updated_at
timestamp 2015-02-12 01:42:22 UTC
type audit.space.create
actor uaa-id-350
actor_type user
actee e7888314-a0a5-446d-8e29-0d8521c19f49
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "7e101853-c751-49c0-8d04-6de8899914b7"
  }
}
space_id 8
organization_guid 7e101853-c751-49c0-8d04-6de8899914b7
space_guid e7888314-a0a5-446d-8e29-0d8521c19f49
actor_name email-271@somedomain.com
actee_name development