# LitmusEdgeManager 2.31.x API Documentation/Edge Lifecycle Management/Applications - LE, LEM, LUNS API Docs

## Catalogs

**GET** `{{LEM_URL}}/mpcs/catalogs`

# Catalogs

Returns the marketplace catalogs available to LEM. Same payload as `Features > Marketplace Catalog > Get Marketplace Catalogs` -- exposed here as a convenience for the launch flow.
## Endpoint

```http
GET {{LEM_URL}}/mpcs/catalogs
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "id": "effd5e74-2d3c-4a7a-bf7d-58fa7d6ae9e4",
        "name": "Catalog Applications",
        "description": "Default applications catalog",
        "role": "off"
    },
    {
        "id": "edd3b845-a9c0-4db5-9684-03e521409af3",
        "name": "Solutions",
        "description": "",
        "role": "off"
    }
]
```

---

## Catalog Applications

**GET** `{{LEM_URL}}/mpcs/catalogs/effd5e74-2d3c-4a7a-bf7d-58fa7d6ae9e4/applications`

# Catalog Applications

Returns the apps in a specific catalog (resolved by catalog UUID in the path).
## Endpoint

```http
GET {{LEM_URL}}/mpcs/catalogs/effd5e74-2d3c-4a7a-bf7d-58fa7d6ae9e4/applications
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "id": "d049666e-b9e9-4355-9086-289a8468ea2b",
        "name": "Minio",
        "description": "Minio is an Amazon S3 compatible object storage server.",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "7eb28633-cad6-468e-a540-ac62d555ac51",
        "name": "Grafana",
        "description": "Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "d9ef6608-c32f-44ff-9f24-cdf9587fe559",
        "name": "MongoDB",
        "description": "MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "96d50135-d8ba-4dc3-93c7-b8cfd7ec9b25",
        "name": "Ms SQL for Linux",
        "description": "Microsoft SQL Server is a relational database developed by Microsoft.",
        "category": "Database",
        "icon": "<catalog icon>"
    },
    {
        "id": "86a119dd-10e3-45bc-ab73-72e325a69aa7",
        "name": "MySQL",
        "description": "MySQL is an open-source relational database management system (RDBMS).",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "563a71ca-fff4-4a88-a6d5-7004039b4211",
        "name": "PostgreSQL & Adminer",
        "description": "PostgreSQL, often simply \"Postgres\", is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance.",
        "category": "Database",
        "icon": "<catalog icon>"
    },
    {
        "id": "46f15f5f-efa9-4b98-81f9-ad8ab41c163e",
        "name": "KDB",
        "description": "KDB is a small pluggable IRC Bot framework utilizing the circuits Python Application Framework.",
        "category": "Utility",
        "icon": "<catalog icon>"
    },
    {
        "id": "039712df-918c-45ce-b63a-1aa14e62bfd6",
        "name": "PipelineDB",
        "description": "PipelineDB is a PostgreSQL extension for high-performance time-series aggregation, designed to power realtime reporting and analytics applications.",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "7a306f32-90ab-461d-9557-20fdf6104665",
        "name": "Python",
        "description": "This template creates an application with Python",
        "category": "Utils",
        "icon": "<catalog icon>"
    },
    {
        "id": "e51fcaf5-4908-449a-a6c7-ff114e1d2784",
        "name": "Elasticsearch",
        "description": "Elasticsearch is a distributed, RESTful search and analytics engine.",
        "category": "Utils",
        "icon": "<catalog icon>"
    }
]
```

---

## Device Applications

**GET** `{{LEM_URL}}/api/v1/marketplace/app/list?projectId={{project_id}}&deviceId={{device_id}}`

# Device Applications

Returns the catalog apps currently installed on one device with full configuration (containers, parameters, catalog association).
## Endpoint

```http
GET {{LEM_URL}}/api/v1/marketplace/app/list?projectId={{project_id}}&deviceId={{device_id}}
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```json
[
    {
        "id": "ca877b46-1a8c-11ed-8791-94c6911b9c77",
        "name": "MySQL",
        "status": "RUNNING",
        "statusChangedAt": 1695684581000,
        "containers": [
            {
                "name": "mysql-mysql",
                "state": ""
            },
            {
                "name": null,
                "state": null
            }
        ],
        "parameters": {
            "stack_description": "MySQL is an open-source relational database management system (RDBMS).",
            "MYSQL_DATABASE": "sample",
            "MYSQL_PASSWORD": "loopedge-s3cr3t!",
            "MYSQL_PORT": "3306",
            "MYSQL_ROOT_PASSWORD": "loopedge-s3cr3t!",
            "MYSQL_USER": "user",
            "RESTART": "always",
            "stack_name": "MySQL"
        },
        "catalogId": "c93dbe1b-1a8c-11ed-8d9d-94c6911b9c77",
        "catalogApplicationId": "0aa40818-2553-4f1c-8221-dbf19804efe4",
        "releaseName": "8.0.23"
    }
]
```

---

## Launch Application to Edge Device

**POST** `{{LEM_URL}}/api/v1/async-task/task-with-subtasks`

# Launch Application to Edge Device

Creates an **async task** that launches a catalog app on one or more devices. The body is an async-task envelope with `subtasks[]` -- one per target device, each carrying the app ID and parameters.
## Endpoint

```http
POST {{LEM_URL}}/api/v1/async-task/task-with-subtasks
```
## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.
## Request body

```json
{
  "name": "Launch Marketplace application (1 edge device)",
  "description": "",
  "params": {},
  "companyName": "{{company_name}}",
  "projectId": "{{project_id}}",
  "subtasks": [
    {
      "deviceId": "{{edge_device_id}}",
      "num": 0,
      "params": {
        "applicationId": "7a306f32-...",
        "applicationName": "..."
      }
    }
  ]
}
```

## Response

`200 OK` -- `application/json`

```json
{ "taskId": "3821ae43-d75b-43f7-a85a-f95da580b5de" }
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Request Body

```json
{
    "name": "Launch Marketplace application (1 edge device)",
    "description": "",
    "params": {},
    "companyName": "{{company_name}}",
    "projectId": "{{project_id}}",
    "subtasks": [
        {
            "deviceId": "{{edge_device_id}}",
            "num": 0,
            "params": {
                "applicationDescription": "This template creates an application with Python",
                "applicationId": "7a306f32-90ab-461d-9557-20fdf6104665",
                "applicationName": "Python",
                "applicationParameters": {
                    "RESTART": "always"
                },
                "applicationVersion": "3.9-slim",
                "catalogId": "effd5e74-2d3c-4a7a-bf7d-58fa7d6ae9e4",
                "catalogName": "Catalog Applications",
                "catalogUrl": "{{LEM_URL}}/mpcs"
            },
            "type": "MARKETPLACE_APPLICATION_LAUNCH",
            "plannedExecTime": 0
        }
    ],
    "type": "MARKETPLACE_APPLICATION_LAUNCH",
    "waitForOnline": false
}
```

### Response

**Status**: 200 OK

```json
{
    "taskId": "3821ae43-d75b-43f7-a85a-f95da580b5de"
}
```

---

