Create App

Create an app with a specified app spec URL.

Only super admin is able to send this request.

post
Create App

https://environment.lvis.io/api/v2/apps
Request
Response
Request
Headers
Authorization
required
string
Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
Content-Type
required
string
application/vnd.api+json
Body Parameters
spec_url
required
string
App specification URL.
Response
201: Created
{
"data": {
"type": "apps",
"relationships": {
"account": {
"data": {
"type": "accounts",
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
},
"attributes": {
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
}
}

Example

Request
Response
cURL
Request
// POST /api/v2/apps
// Host: environment.lvis.io
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "apps",
"relationships": {
"account": {
"data": {
"type": "accounts",
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
},
"attributes": {
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
}
}
Response
// Status: 201 Created
{
"data": {
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e",
"type": "apps",
"attributes": {
"name": "Elements",
"app_id": "elements",
"version": "23.0.0"
}
}
}
cURL
curl --request POST \
--url https://environment.lvis.io/api/v2/apps \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "apps",
"relationships": {
"account": {
"data": {
"type": "accounts",
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
},
"attributes": {
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
}
}'

The app is created within the account with id 8630c508-7d12-4e6d-85d5-5e507e97738e as set by /data/relationships/account/data/id.

Validation error on app creation

In this example we are trying to create an app with invalid spec URL.

The request fails with 422 (Unprocessable Entity) status and corresponding error message.

Request
Response
Request
// POST /api/v2/apps
// Host: environment.lvis.io
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "apps",
"relationships": {
"account": {
"data": {
"type": "accounts",
"id": "7a4c58d9-9e3b-4e63-8ea6-bb68785640e1"
}
}
},
"attributes": {
"spec_url": "invalid-spec-url"
}
}
}
Response
// Status: 422 Unprocessable Entity
{
"errors": [
{
"source": {
"pointer": "/data/attributes/spec_url"
},
"detail": "Loading of the `App Spec` failed with the error(s): not a valid URL"
}
]
}