Create Project

Create project within specified application.

post
Create Project

https://environment.lvis.io/api/v2/projects
Request
Response
Request
Headers
Authorization
required
string
Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
Content-Type
required
string
application/vnd.api+json
Body Parameters
name
required
string
Project's name.
audio_sync_default_delay
optional
integer
Project's audio sync default delay.
audio_sync_max_delay
optional
integer
Project's audio sync max delay.
certification_enabled
optional
boolean
Defines if Certification is enabled for a project.
locales
optional
array
List of project locales.
settings
required
array
List of fields of project settings. Each field is updated separately and if present its content is rewritten completely.
Response
201: Created
{
"data": {
"id":"a8e22ad3-b8b1-4fe2-a08a-45e5ba39df7d",
"attributes": {
"assets": {},
"audio_sync_default_delay": 2,
"audio_sync_max_delay": 5,
"certification_enabled": true,
"embed": "//apps.lvis.tv/elements/20.2.1/app.html?p=a8e22ad3-b8b1-4fe2-a08a-45e5ba39df7d&h=d3vtzxnppyvur.cloudfront.net",
"history_ignore": 45,
"locales": [
{
"active": true,
"default": false,
"key": "de"
},
{
"active": true,
"default": true,
"key": "en"
}
],
"name": "Project",
"tracking_id": "UA-XXXXX-X"
},
"links": {
"self": "http://example.lvis.io/api/v2/projects/a8e22ad3-b8b1-4fe2-a08a-45e5ba39df7d"
},
"relationships": {
"events": {
"links": {
"related": "http://example.lvis.io/api/v2/projects/a8e22ad3-b8b1-4fe2-a08a-45e5ba39df7d/events"
}
}
},
"type": "projects"
}
}

Example

Request
Response
cURL
Request
// POST /api/v2/projects
// Host: environment.lvis.io
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "projects",
"relationships": {
"app": {
"data": {
"type": "apps",
"id": "a26b52f0-8ad7-423b-91b9-7ea18702c939"
}
},
"account": {
"data": {
"type": "accounts",
"id": "86e3ce6b-f637-4458-a34f-7ef9feb1d780"
}
}
},
"attributes": {
"name": "Project Name",
"locales": [
{
"key": "en",
"default": true,
"active": true
},
{
"key": "de",
"default": false,
"active": true
}
],
"settings": [
{
"key": "prompt_live_event",
"values": {
"en": "Another Text",
"de": "Ein anderer Text"
}
},
{
"key": "language_selector_position",
"values": {
"all": "left"
}
}
]
}
}
}
Response
// Status: 201 Created
{
"data": {
"id": "471eaa2c-6b3f-4678-8889-30b1806829c0",
"type": "projects",
"attributes": {
"name": "Project Name",
"locales": [
{
"active": true,
"default": true,
"key": "en"
},
{
"active": true,
"default": false,
"key": "de"
}
],
"certification_enabled": false,
"settings": [
{
"key": "logo",
"values": {
"en": null,
"de": null
}
},
{
"key": "language_selector_position",
"values": {
"all": "left"
}
},
{
"key": "show_last_element_on_load",
"values": {
"all": true
}
},
{
"key": "prompt_no_event",
"values": {
"en": "No event available",
"de": null
}
},
{
"key": "prompt_unstarted_event",
"values": {
"en": "This event hasn't started yet",
"de": null
}
},
{
"key": "prompt_live_event",
"values": {
"en": "Another Text",
"de": "Ein anderer Text"
}
},
{
"key": "prompt_finished_event",
"values": {
"en": "This event has now finished",
"de": null
}
}
],
"history_ignore": 45,
"audio_sync_default_delay": 0,
"audio_sync_max_delay": 0,
"embed": "//apps.lvis.io/elements/22.6.3/app.html?p=c3deeb7c-2d0c-4173-99f6-9dd82c098d3c&h=d1hox4kfomq6ql.cloudfront.net",
"tracking_id": "",
"assets": {}
},
"relationships": {
"events": {
"links": {
"related": "https://environment.lvis.io/api/v2/projects/471eaa2c-6b3f-4678-8889-30b1806829c0/events"
}
}
},
"links": {
"self": "https://environment.lvis.io/api/v2/projects/471eaa2c-6b3f-4678-8889-30b1806829c0"
}
}
}
cURL
curl --request POST \
--url https://environment.lvis.io/api/v2/projects \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "projects",
"relationships": {
"app": {
"data": {
"type": "apps",
"id": "a26b52f0-8ad7-423b-91b9-7ea18702c939"
}
},
"account": {
"data": {
"type": "accounts",
"id": "86e3ce6b-f637-4458-a34f-7ef9feb1d780"
}
}
},
"attributes": {
"name": "Project Name",
"locales": [
{
"key": "en",
"default": true,
"active": true
},
{
"key": "de",
"default": false,
"active": true
}
],
"settings": [
{
"key": "prompt_live_event",
"values": {
"en": "Another Text",
"de": "Ein anderer Text"
}
},
{
"key": "language_selector_position",
"values": {
"all": "left"
}
}
]
}
}
}'

Here we create a project with name Project Name as specified in /data/attributes/name attribute.

The project has two locales with English as default.

In /data/attributes/settings we set two fields. Field prompt_live_event is localisable and you need to fill each locale as shown in the example. Field language_selector_position is non-localisable, so the data for it goes into all key.

Available fields for /data/attributes/settings defined in project settings spec.

The project is created within the app with id a26b52f0-8ad7-423b-91b9-7ea18702c939 as set by /data/relationships/app/data/id and within the account with id 86e3ce6b-f637-4458-a34f-7ef9feb1d780 as set by /data/relationships/account/data/id.

Validation error messages about invalid attributes

Request
Response
Request
// POST /api/v2/projects
// Host: environment.lvis.io
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "projects",
"attributes": {
"name": "Project Name"
}
}
}
Response
// Status: 422 Unprocessable Entity
{
"errors": [
{
"source": {
"pointer": "/data/attributes/settings"
},
"detail": "is missing"
},
{
"source": {
"pointer": "/data/relationships"
},
"detail": "is missing"
}
]
}