Create App

Create an app with a specified app spec URL.

This request requires at least a brand admin role.

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": {
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e",
"type": "apps",
"attributes": {
"name": "Elements",
"app_id": "elements",
"version": "24.0.0",
"social_curation_enabled": false,
"schedule_enabled": true,
"analytics_enabled": true,
"live_activity_enabled": true,
"localisation_enabled": true,
"created_at": 1598434373,
"created_at_iso": "2020-08-26T09:32:53Z",
"updated_at": 1598434373,
"updated_at_iso": "2020-08-26T09:32:53Z",
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
"links": {
"self": "https://environment.lvis.io/api/v2/apps/8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
}

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": {
"brand": {
"data": {
"type": "brands",
"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": "24.0.0",
"social_curation_enabled": false,
"schedule_enabled": true,
"analytics_enabled": true,
"live_activity_enabled": true,
"localisation_enabled": true,
"created_at": 1598434373,
"created_at_iso": "2020-08-26T09:32:53Z",
"updated_at": 1598434373,
"updated_at_iso": "2020-08-26T09:32:53Z",
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
"links": {
"self": "https://environment.lvis.io/api/v2/apps/8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
}
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": {
"brand": {
"data": {
"type": "brands",
"id": "8630c508-7d12-4e6d-85d5-5e507e97738e"
}
}
},
"attributes": {
"spec_url": "https://environment.company.co.uk/specs/version/spec.json"
}
}
}'

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

Validation error on app creation

In this example, we are trying to create an app with an 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": {
"brand": {
"data": {
"type": "brands",
"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"
}
]
}