# Lösung

## Abfragen

***

### <mark style="background-color:yellow;">get\_solution</mark>

Ruft die Details einer Lösung ab.

#### Parameter

* `id` (erforderlich): Die ID der Lösung.

#### Beispiel

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "get_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930"
        }
    }'
```

#### **Lösungs-Antwort**

* `id`: Die ID der Lösung.
* `organization_id`: Die ID der Organisation, zu der die Lösung gehört.
* `workspace_id`: Die ID des Arbeitsbereichs, zu dem die Lösung gehört.
* `created_at`: Datum und Uhrzeit der Erstellung der Lösung.
* `updated_at`: Datum und Uhrzeit der letzten Aktualisierung der Lösung.
* `name`: Der Name der Lösung.
* `description`: Die Beschreibung der Lösung.
* `attributes`: Optionale Schlüssel-Wert-Paare, die der Lösung zugeordnet sind.
* `documentation`: Ein JSON-Objekt, das die Block-Typ-Dokumentation für die Lösung enthält. *Dokumentation dieses JSON-Objekts folgt in Kürze.*

#### Beispielantwort

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Finanzanalyse",
        "description": "Finanzanalyse-Lösung für den Finanz-Arbeitsbereich",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "Dies ist ein Beispiel-Dokumentationsblock"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">list\_solutions</mark>

Seitenweise Auflistung aller Lösungen, auf die der Benutzer Zugriff hat.

#### Parameter

* `page` (erforderlich): Die zurückzugebende Seitennummer. `minimum: 1`
* `size` (erforderlich): Die Anzahl der Elemente pro Seite. `minimum: 1, maximum: 100`

#### Beispiel

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "list_solutions",
        "params": {
            "page": 1,
            "size": 10
        }
    }'
```

#### Antwort

* `total`: Die Gesamtanzahl der Lösungen, auf die der Benutzer Zugriff hat.
* `page`: Die aktuelle Seitennummer.
* `size`: Die angeforderte Anzahl von Elementen pro Seite.
* `items`: Ein Array von Lösungen. Weitere Details finden Sie unter [Lösungs-Antwort](#lösungs-antwort).

#### Beispielantwort

```json
{
    "data": {
        "total": 1,
        "page": 1,
        "size": 100,
        "items": [
            {
                "id": "sol_cv33u4n0i6q45p93i930",
                "organization_id": "org_cv33u4n0i6q45p93i930",
                "workspace_id": "ws_cv33u4n0i6q45p93i930",
                "created_at": "2025-03-24T15:12:49.186202Z",
                "updated_at": "2025-03-24T20:01:59.408382Z",
                "name": "Finanzanalyse",
                "description": "Finanzanalyse-Lösung für den Finanz-Arbeitsbereich",
                "attributes": {
                    "key": "value"
                },
                "documentation": {
                    "blocks": [
                        {
                            "type": "text",
                            "content": "Dies ist ein Beispiel-Dokumentationsblock"
                        }
                    ]
                }
            }
        ]
    }
}
```

## Befehle

***

### <mark style="background-color:yellow;">create\_solution</mark>

Verwenden Sie diesen Befehl, um eine neue Lösung zu erstellen.

#### Parameter

* `workspace_id` (erforderlich): Die ID des Arbeitsbereichs, in dem die Lösung erstellt werden soll.
* `name` (erforderlich): Name der Lösung. `minimum: 1` `maximum: 50` `nur Unicode-Zeichen`
* `description` (optional): Beschreibung der Lösung. `maximum: 255` `nur Unicode-Zeichen`
* `attributes` (optional): Optionale Schlüssel-Wert-Paare, die der Lösung zugeordnet werden sollen.
* `documentation` (optional): Ein JSON-Objekt, das die Block-Typ-Dokumentation für die Lösung enthält.

#### Beispiel

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "create_solution",
        "params": {
            "organization_id": "org_cv33u4n0i6q45p93i930",
            "workspace_id": "ws_cv33u4n0i6q45p93i930",
            "name": "Finanzanalyse",
            "description": "Finanzanalyse-Lösung für den Finanz-Arbeitsbereich",
            "attributes": {
                "key1": "value1",
                "key2": 100,
                "key3": {
                    "nested": true
                }
            },
            "documentation": {
                "blocks": [
                    {
                        "type": "text",
                        "content": "Dies ist ein Beispiel-Dokumentationsblock"
                    }
                ]
            }
        }
    }'
```

#### Antwort

Die Antwort ist die [Lösungs-Antwort](#lösungs-antwort) der erstellten Lösung.

#### Beispielantwort

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Finanzanalyse",
        "description": "Finanzanalyse-Lösung für den Finanz-Arbeitsbereich",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "Dies ist ein Beispiel-Dokumentationsblock"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">update\_solution</mark>

Verwenden Sie diesen Befehl, um eine Lösung zu aktualisieren.

#### Parameter

* `id` (erforderlich): Die ID der zu aktualisierenden Lösung.
* `name` (erforderlich): Der Name der Lösung.
* `description` (optional): Die Beschreibung der Lösung.
* `attributes` (optional): Ein JSON-Objekt mit Schlüssel-Wert-Paaren, die der Lösung hinzugefügt werden sollen.
* `documentation` (optional): Ein JSON-Objekt, das die Block-Typ-Dokumentation für die Lösung enthält.

#### Beispiel

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "update_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930",
            "name": "Aktualisierter Lösungsname",
            "description": "Aktualisierte Lösungsbeschreibung",
            "attributes": {
                "key": "value"
            },
            "documentation": {
                "blocks": [
                    {
                        "type": "text",
                        "content": "Dies ist ein Beispiel-Dokumentationsblock"
                    }
                ]
            }
        }
    }'
```

#### Antwort

Die Antwort ist die [Lösungs-Antwort](#lösungs-antwort) der aktualisierten Lösung.

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Aktualisierter Lösungsname",
        "description": "Aktualisierte Lösungsbeschreibung",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "Dies ist ein Beispiel-Dokumentationsblock"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">delete\_solution</mark>

Verwenden Sie diesen Befehl, um eine Lösung zu löschen.

{% hint style="danger" %}
**Diese Aktion ist nicht rückgängig zu machen. Verwenden Sie diesen Befehl mit Vorsicht.**
{% endhint %}

#### Parameter

* `id` (erforderlich): Die ID der zu löschenden Lösung.

#### Beispiel

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "delete_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930"
        }
    }'
```

#### Antwort

Die Antwort ist die [Lösungs-Antwort](#lösungs-antwort) der gelöschten Lösung.

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930"
    }
}
```

* `id`: Die ID der Lösung, die gelöscht wurde.
