Create App

Create an app with a specified app spec URL.

This request requires at least a brand admin role.

Create App

POST https://environment.monterosa.cloud/api/v2/apps

Headers

NameTypeDescription

Authorization

string

Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb

Content-Type

string

application/vnd.api+json

Request Body

NameTypeDescription

spec_url

string

App specification URL.

{
  "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

// POST /api/v2/apps
// Host: environment.monterosa.cloud
// 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"
    }
  }
}

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.

// POST /api/v2/apps
// Host: environment.monterosa.cloud
// 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"
    }
  }
}