# Example - static site

All requests use the base URL `https://api.plsk.org/api/plesk/v2` and a subscription key. `{id}` is the `id` returned by `GET /domains` for the main domain of the subscription.

| Operation | Request |
|---|---|
| Write a text file | `PUT /domains/{id}/fs/content?path=index.html` with `{"encoding": "plain", "content": "<h1>Hello</h1>"}` |
| Write a binary file | `PUT /domains/{id}/fs/content?path=logo.png` with `{"encoding": "base64", "content": "<base64>"}` |
| Append a chunk to a large file | `PATCH /domains/{id}/fs/content?path=<path>` with the next chunk in the same format |
| List a directory | `GET /domains/{id}/fs/list?path=/httpdocs` |
| Read a file | `GET /domains/{id}/fs/content?path=index.html` |
| Create a directory | `POST /domains/{id}/fs/mkdir` |
| Delete a file or directory | `DELETE /domains/{id}/fs?path=old.html` |

Rewrite rules are supported through `.htaccess`, for example for single-page applications:

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.html [L]
```

Via MCP, the same requests are issued with `site_api` (`path`: `/domains/{id}/fs/content`, `query`: `{"path": "index.html"}`).
