# REST-API: Store

> Die 12 Operationen des Bereichs Store, mit Parametern, Bodys und Antworten.

Source: https://pithyx.org/de/docs/reference/api/store/
Markdown: https://pithyx.org/de/docs/reference/api/store.md

Erzeugt aus dem OpenAPI-Dokument des Daemons. Konventionen, Anmeldung, der CSRF-Header und der WebSocket stehen unter [API](https://pithyx.org/de/docs/developers/daemon/api/).

## GET /api/store

Administrators only. The Store's settings with the next check time, every catalog with its status, and the newer versions of installed apps. The topic store/admin carries the same and its changes.

**Antworten**

- 200: `application/json`: [StoreState](https://pithyx.org/de/docs/reference/api/schemas/#storestate)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/store/apps

Administrators only. The apps of the enabled catalogs (or of one, by its id) at the newest version this box can run, whose id, name, description or author contains q.

**Parameter**

| Name      | Ort   | Typ    | Pflicht | Beschreibung |
| --------- | ----- | ------ | ------- | ------------ |
| `catalog` | query | string | nein    |              |
| `q`       | query | string | nein    |              |

**Antworten**

- 200: `application/json`: [StoreAppList](https://pithyx.org/de/docs/reference/api/schemas/#storeapplist)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## POST /api/store/catalogs

Administrators only. Adds a custom catalog (unsigned, shown as unverified) by its repository URL: https:// for a public one, which is fetched at once as a job, or SSH (git@host:owner/repository.git) for a private one, for which the box makes a deploy key; add its public key to the repository and fetch the catalog then.

**Anfrage-Body**: `application/json`: [AddCatalogRequest](https://pithyx.org/de/docs/reference/api/schemas/#addcatalogrequest)

**Antworten**

- 200: `application/json`: [CatalogInfo](https://pithyx.org/de/docs/reference/api/schemas/#cataloginfo)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/store/catalogs/{catalog}/apps/{appId}

Administrators only. A catalog app's detail page: its newest version for this box with the manifest, screenshots, homepage, the link to its source in the catalog, and every published version.

**Parameter**

| Name      | Ort  | Typ    | Pflicht | Beschreibung |
| --------- | ---- | ------ | ------- | ------------ |
| `catalog` | path | string | ja      |              |
| `appId`   | path | string | ja      |              |

**Antworten**

- 200: `application/json`: [StoreAppDetails](https://pithyx.org/de/docs/reference/api/schemas/#storeappdetails)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/store/catalogs/{catalog}/apps/{appId}/{version}/icon

Administrators only. The icon of a catalog app's version, checked against the index, with Content-Security-Policy: default-src 'none'; sandbox and nosniff.

**Parameter**

| Name      | Ort   | Typ    | Pflicht | Beschreibung |
| --------- | ----- | ------ | ------- | ------------ |
| `catalog` | path  | string | ja      |              |
| `appId`   | path  | string | ja      |              |
| `version` | path  | string | ja      |              |
| `name`    | query | string | nein    |              |

**Antworten**

- 200: `image/svg+xml`: string (byte)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## POST /api/store/catalogs/{catalog}/apps/{appId}/{version}/package

Administrators only. Takes a catalog app's version from the box's verified copy, checks it like an uploaded package plus the index's hashes and images (store.package.hash_mismatch), the box's version (app.package.box_too_old) and, for an older version, the same dataVersion (app.package.downgrade_unsupported), and keeps it for 15 minutes. Install it with POST /api/apps/packages/{packageId}/install.

**Parameter**

| Name      | Ort  | Typ    | Pflicht | Beschreibung |
| --------- | ---- | ------ | ------- | ------------ |
| `catalog` | path | string | ja      |              |
| `appId`   | path | string | ja      |              |
| `version` | path | string | ja      |              |

**Antworten**

- 200: `application/json`: [AppPackagePreview](https://pithyx.org/de/docs/reference/api/schemas/#apppackagepreview)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/store/catalogs/{catalog}/apps/{appId}/{version}/screenshots/{name}

Administrators only. A screenshot of a catalog app's version (PNG, JPEG or WebP), checked against the index, with Content-Security-Policy: default-src 'none'; sandbox and nosniff.

**Parameter**

| Name      | Ort  | Typ    | Pflicht | Beschreibung |
| --------- | ---- | ------ | ------- | ------------ |
| `catalog` | path | string | ja      |              |
| `appId`   | path | string | ja      |              |
| `version` | path | string | ja      |              |
| `name`    | path | string | ja      |              |

**Antworten**

- 200: `image/png`: string (byte)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## PATCH /api/store/catalogs/{key}

Administrators only. Switches a catalog on (it is fetched at once) or off, or sets (user:token) or removes (empty) the read token for its private images.

**Parameter**

| Name  | Ort  | Typ             | Pflicht | Beschreibung |
| ----- | ---- | --------------- | ------- | ------------ |
| `key` | path | integer (int64) | ja      |              |

**Anfrage-Body**: `application/json`: [UpdateCatalogRequest](https://pithyx.org/de/docs/reference/api/schemas/#updatecatalogrequest)

**Antworten**

- 200: `application/json`: [CatalogInfo](https://pithyx.org/de/docs/reference/api/schemas/#cataloginfo)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## DELETE /api/store/catalogs/{key}

Administrators only. Removes a custom catalog and its copy; apps installed from it stay and get no more updates from it. The project's catalogs can only be switched off (store.catalog.built_in).

**Parameter**

| Name  | Ort  | Typ             | Pflicht | Beschreibung |
| ----- | ---- | --------------- | ------- | ------------ |
| `key` | path | integer (int64) | ja      |              |

**Antworten**

- 204

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## POST /api/store/catalogs/{key}/sync

Administrators only. Fetches one catalog now as a job. A failure keeps the last verified copy and is shown with the catalog.

**Parameter**

| Name  | Ort  | Typ             | Pflicht | Beschreibung |
| ----- | ---- | --------------- | ------- | ------------ |
| `key` | path | integer (int64) | ja      |              |

**Antworten**

- 202: `application/json`: [Job](https://pithyx.org/de/docs/reference/api/schemas/#job)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## POST /api/store/check

Administrators only. Checks now as a job: fetches every enabled catalog, then installs automatic updates and announces the others, as the daily check does.

**Antworten**

- 202: `application/json`: [Job](https://pithyx.org/de/docs/reference/api/schemas/#job)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## PUT /api/store/settings

Administrators only. Sets the update policy (automatic, notify, none), the daily check time (HH:mm in the box's time zone; the box adds its own delay of up to an hour) and the channel (stable reads each catalog's branch catalog, beta its branch catalog-next). A new channel fetches every catalog at once.

**Anfrage-Body**: `application/json`: [StoreSettingsRequest](https://pithyx.org/de/docs/reference/api/schemas/#storesettingsrequest)

**Antworten**

- 200: `application/json`: [StoreSettings](https://pithyx.org/de/docs/reference/api/schemas/#storesettings)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).
