# REST operations

<!-- Generated by `pnpm docs:reference`. Do not edit this file; change the code it is read from. -->

SleekByte serves these operations under `/wp-json`. Each is declared, with its description, in the TypeSpec source of `contracts/api/sleek-byte/openapi.json`.

## Actions

### `Actions_clearErrorLog`

`DELETE /sleek-byte/v1/actions/error-log`, requires `manage_options`.

Clears a snippet's runtime log, which also lets a snippet stopped by repeated fatal errors run again.

### `Actions_createPreview`

`POST /sleek-byte/v1/actions/create-preview`, requires `manage_options`.

Stores unsaved snippet files as a preview that lasts an hour, and returns its id and address.

### `Actions_deletePreview`

`POST /sleek-byte/v1/actions/delete-preview`, requires `manage_options`.

Removes a preview.

### `Actions_downloadAsset`

`POST /sleek-byte/v1/actions/download-asset`, requires `manage_options`.

Downloads a public HTTP or HTTPS asset of up to 5 MB into `uploads/sleek-byte-assets`, named after its handle.

### `Actions_errorLog`

`GET /sleek-byte/v1/actions/error-log`, requires `manage_options`.

The errors a snippet's PHP files raised while loading, from its runtime log.

### `Actions_exportSnippet`

`POST /sleek-byte/v1/actions/export-snippet`, requires `manage_options`.

Builds the files of a standalone plugin that runs the given snippets.

### `Actions_exportSnippetZip`

`POST /sleek-byte/v1/actions/export-snippet-zip`, requires `manage_options`.

Builds that standalone plugin as a ZIP archive in Byte's temporary uploads folder and returns its path.

### `Actions_gitCheck`

`GET /sleek-byte/v1/actions/git-check`, requires `manage_options`.

Whether Git history is on and which top-level snippet folders hold a `.git` directory.

### `Actions_gitRead`

`GET /sleek-byte/v1/actions/git-read`, requires `manage_options`.

A snippet's `.git` directory, every file base64-encoded.

### `Actions_gitWrite`

`POST /sleek-byte/v1/actions/git-write`, requires `manage_options`.

Writes files into a snippet's `.git` directory; any other path is ignored.

### `Actions_listFiles`

`GET /sleek-byte/v1/actions/list-files`, requires `manage_options`.

Every snippet source with the paths and contents of the files it holds.

### `Actions_testPhpCode`

`POST /sleek-byte/v1/actions/test-php-code`, requires `manage_options`.

Checks PHP files before they are saved: each is parsed for syntax errors,
and shell execution and variable function calls are refused. The code is
not run.

### `Actions_updateFiles`

`POST /sleek-byte/v1/actions/update-files`, requires `manage_options`.

Writes changed files and deletes removed ones, only inside a snippet source.

## Data

### `Data_posts`

`GET /sleek-byte/v1/data/posts`, requires `manage_options`.

The posts a picker offers for a search and a list of post types.

### `Data_query`

`POST /sleek-byte/v1/data/query`, requires `manage_options`.

Queries posts, a custom table or a remote source with the arguments a
screen built.
