Create Space
POST
/api/v2/spaces
Headers
Name
Type
Description
Authorization
string
Content-Type
string
application/vnd.api+json
Request Body
Name
Type
Description
name
string
Space name
image_url
string
Space image URL
{
"data": {
"id": "e528eeeb-9b0d-4625-9243-ab7ba8cdd612",
"type": "spaces",
"attributes": {
"name": "Monterosa",
"image_url": null,
"total_interactions": 0,
"projects_count": 0,
"apps_count": 0
},
"relationships": {
"organisation": {
"data": {
"id": "3688b1f3-1661-4ae3-b304-32097da06b63",
"type": "organisations"
}
},
"projects": {
"links": {
"related": "https://environment.lvis.io/api/v2/spaces/e528eeeb-9b0d-4625-9243-ab7ba8cdd612/projects"
}
}
},
"links": {
"self": "https://environment.lvis.io/api/v2/spaces/e528eeeb-9b0d-4625-9243-ab7ba8cdd612"
}
}
}
Example
// POST /api/v2/organisations/3688b1f3-1661-4ae3-b304-32097da06b63/spaces
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "spaces",
"relationships": {
"organisation": {
"data": {
"type": "organisations",
"id": "1d21c625-4db0-43e1-ac65-ce8a385e1c64"
}
}
},
"attributes": {
"name": "Monterosa",
"image_url": "https://monterosa.co.uk/space.jpg"
}
}
}
{
"data": {
"id": "e528eeeb-9b0d-4625-9243-ab7ba8cdd612",
"type": "spaces",
"attributes": {
"name": "Monterosa",
"image_url": null,
"total_interactions": 0,
"projects_count": 0,
"apps_count": 0
},
"relationships": {
"organisation": {
"data": {
"id": "3688b1f3-1661-4ae3-b304-32097da06b63",
"type": "organisations"
}
},
"projects": {
"links": {
"related": "https://environment.monterosa.cloud/api/v2/spaces/e528eeeb-9b0d-4625-9243-ab7ba8cdd612/projects"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/spaces/e528eeeb-9b0d-4625-9243-ab7ba8cdd612"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/spaces \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "spaces",
"relationships": {
"organisation": {
"data": {
"type": "organisations",
"id": "1d21c625-4db0-43e1-ac65-ce8a385e1c64"
}
}
},
"attributes": {
"name": "Monterosa",
"image_url": "https://monterosa.co.uk/space.jpg"
}
}
}'
Validation error on account creation
Here in the example, we are trying to create a space with name "New Space" that already exists.
Returned response with 422(Unprocessable Entity) status and error message.
// POST /api/v2/organisations/3688b1f3-1661-4ae3-b304-32097da06b63/spaces
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "spaces",
"relationships": {
"organisation": {
"data": {
"type": "organisations",
"id": "1d21c625-4db0-43e1-ac65-ce8a385e1c64"
}
}
},
"attributes": {
"name": "New Space",
"image_url": "https://monterosa.co.uk/space.jpg"
}
}
}
// Status: 422 Unprocessable Entity
{
"errors": [
{
"source": {
"pointer": "/data/attributes/name"
},
"detail": "has already been taken"
}
]
}
Last updated
Was this helpful?