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-7ffcf1cb-b70d-48fc-9bf5-951b1287bed8
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
allow_ssh Whether or not Space Developers can enable ssh on apps in the space
isolation_segment_guid The guid of the isolation segment to assign to the space. The space's organization must be entitled for the isolation segment.
{
  "name": "development",
  "organization_guid": "28960823-1b68-4a2b-8f36-77cc573bccca"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2MCIsImVtYWlsIjoiZW1haWwtMjU0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjYwMDg5MDB9.KG16J1xFGi1sMmGJaHld3bHLRB6Tj9TxIHiImT0nbXE
Host: example.org
Content-Type: application/json
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "28960823-1b68-4a2b-8f36-77cc573bccca"
}' -X POST \
  -H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2MCIsImVtYWlsIjoiZW1haWwtMjU0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjYwMDg5MDB9.KG16J1xFGi1sMmGJaHld3bHLRB6Tj9TxIHiImT0nbXE" \
  -H "Host: example.org" \
  -H "Content-Type: application/json" \
  -H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "2a01cf80-9fbf-448f-a7a0-1e415e28771e",
    "url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e",
    "created_at": "2016-06-08T16:41:40Z",
    "updated_at": "2016-06-08T16:41:26Z"
  },
  "entity": {
    "name": "development",
    "organization_guid": "28960823-1b68-4a2b-8f36-77cc573bccca",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/28960823-1b68-4a2b-8f36-77cc573bccca",
    "developers_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/developers",
    "managers_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/managers",
    "auditors_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/auditors",
    "apps_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/apps",
    "routes_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/routes",
    "domains_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/domains",
    "service_instances_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/service_instances",
    "app_events_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/app_events",
    "events_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/events",
    "security_groups_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/security_groups",
    "staging_security_groups_url": "/v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e/staging_security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/2a01cf80-9fbf-448f-a7a0-1e415e28771e
X-VCAP-Request-ID: afea22e9-7613-47bd-915e-43de5923ba13
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 3
guid 3ae5862c-fb43-49ed-935b-8feb7d0e19e8
created_at 2016-06-08 16:41:40 UTC
updated_at
timestamp 2016-06-08 16:41:40 UTC
type audit.space.create
actor uaa-id-360
actor_type user
actee 2a01cf80-9fbf-448f-a7a0-1e415e28771e
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "28960823-1b68-4a2b-8f36-77cc573bccca",
    "allow_ssh": true
  }
}
space_id
organization_guid 28960823-1b68-4a2b-8f36-77cc573bccca
space_guid 2a01cf80-9fbf-448f-a7a0-1e415e28771e
actor_name [email protected]
actee_name development