Home
Version 3
Spaces API

Spaces API

Creating a Space

POST /v2/spaces/

Request

Route

POST /v2/spaces

Body

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-3ecdfae7-ac81-4e65-b3cf-83f0c080bc0b
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
{
  "name": "development",
  "organization_guid": "bbb68e99-01c6-4dc0-85a4-0c3eefca1d47"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE4OSIsImVtYWlsIjoiZW1haWwtMTExQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0Mjk2NjQxMzl9.DLz8MhUdQ9X-y_ADWrIGnvd6g3ivXAwX8zkX5OoJ2Zo
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "bbb68e99-01c6-4dc0-85a4-0c3eefca1d47"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE4OSIsImVtYWlsIjoiZW1haWwtMTExQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0Mjk2NjQxMzl9.DLz8MhUdQ9X-y_ADWrIGnvd6g3ivXAwX8zkX5OoJ2Zo" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "bbb79443-5b68-4300-a556-826185fd3493",
    "url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493",
    "created_at": "2015-04-15T00:55:39Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "bbb68e99-01c6-4dc0-85a4-0c3eefca1d47",
    "space_quota_definition_guid": null,
    "organization_url": "/v2/organizations/bbb68e99-01c6-4dc0-85a4-0c3eefca1d47",
    "developers_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/developers",
    "managers_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/managers",
    "auditors_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/auditors",
    "apps_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/apps",
    "routes_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/routes",
    "domains_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/domains",
    "service_instances_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/service_instances",
    "app_events_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/app_events",
    "events_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/events",
    "security_groups_url": "/v2/spaces/bbb79443-5b68-4300-a556-826185fd3493/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/bbb79443-5b68-4300-a556-826185fd3493
X-VCAP-Request-ID: 478b9267-4747-4271-b9d8-24c20b7aee88
Content-Length: 1257
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 150
guid 3107ef14-e757-495a-9b49-1547e54b01c7
created_at 2015-04-15 00:55:39 UTC
updated_at
timestamp 2015-04-15 00:55:39 UTC
type audit.space.create
actor uaa-id-189
actor_type user
actee bbb79443-5b68-4300-a556-826185fd3493
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "bbb68e99-01c6-4dc0-85a4-0c3eefca1d47"
  }
}
space_id 201
organization_guid bbb68e99-01c6-4dc0-85a4-0c3eefca1d47
space_guid bbb79443-5b68-4300-a556-826185fd3493
actor_name email-111@somedomain.com
actee_name development