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-ff4398e1-d1c1-4aa2-b412-14734135c916
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
{
  "name": "development",
  "organization_guid": "f2135532-6764-4392-b6b6-8493acc3ab83"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMxNyIsImVtYWlsIjoiZW1haWwtMjE5QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjE5NTg0MDd9.uMM_iTD0Sd_qnvZBqV_EJP81e020C-IqfdJqX80Y6LI
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": "f2135532-6764-4392-b6b6-8493acc3ab83"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMxNyIsImVtYWlsIjoiZW1haWwtMjE5QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjE5NTg0MDd9.uMM_iTD0Sd_qnvZBqV_EJP81e020C-IqfdJqX80Y6LI" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "edce3438-fed9-46ab-90fd-53f268836820",
    "url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820",
    "created_at": "2016-04-22T19:33:27Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "f2135532-6764-4392-b6b6-8493acc3ab83",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/f2135532-6764-4392-b6b6-8493acc3ab83",
    "developers_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/developers",
    "managers_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/managers",
    "auditors_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/auditors",
    "apps_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/apps",
    "routes_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/routes",
    "domains_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/domains",
    "service_instances_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/service_instances",
    "app_events_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/app_events",
    "events_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/events",
    "security_groups_url": "/v2/spaces/edce3438-fed9-46ab-90fd-53f268836820/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/edce3438-fed9-46ab-90fd-53f268836820
X-VCAP-Request-ID: 273580a3-5cbb-49c9-93ed-43ef59e78724
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 42
guid a3eebec4-64d4-4501-bdaf-b7ab5fe59a9b
created_at 2016-04-22 19:33:27 UTC
updated_at
timestamp 2016-04-22 19:33:27 UTC
type audit.space.create
actor uaa-id-317
actor_type user
actee edce3438-fed9-46ab-90fd-53f268836820
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "f2135532-6764-4392-b6b6-8493acc3ab83",
    "allow_ssh": true
  }
}
space_id
organization_guid f2135532-6764-4392-b6b6-8493acc3ab83
space_guid edce3438-fed9-46ab-90fd-53f268836820
actor_name email-219@somedomain.com
actee_name development