mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
The pages under doc/ are split where one paragraph or list item held several topics, so a reader finds a step by its heading: - install.md: what a re-run keeps and replaces as a list; first login and a lost password apart. - compute-nodes.md: a heading per step and per connection type (SSH, TCP, TLS), the firewall rule first, the gstfsd network warning before its commands, the migration certificates as a list. - configuration.md: commands in code blocks; local settings rules as a list; one place that says how to run manage.py; the proxy layouts apart; the health check its own heading. The security headers move to architecture.md. - ldap.md: one complete example for Active Directory and one for OpenLDAP. Pasting the old page's blocks gave OpenLDAP values over the Active Directory ones. - backups.md: panel and VM backups as two sections; VM backups by target, backup, restore, owners, schedules and verification. - upgrading.md: a list of its paths, the supervisor move after the update it precedes, and the old settings.py rules as sub-items. The behavior changes move to behavior-changes.md. - api.md: the token, job and error rules in one page; architecture.md links to it. - permissions.md: template and console-setting rules under their own headings instead of inside the table. - CONTRIBUTING.md: local, live KVM and Vagrant tests apart. No command changed.
21 lines
1.3 KiB
Markdown
21 lines
1.3 KiB
Markdown
# REST API
|
|
|
|
The REST API (Django REST Framework, documented with `drf-spectacular`) takes the login session or an API token. After logging in:
|
|
|
|
* **Swagger UI:** `http://<server>/swagger/`
|
|
* **ReDoc UI:** `http://<server>/redoc/`
|
|
* **OpenAPI 3.0 schema:** `http://<server>/api/schema/` (JSON or YAML)
|
|
|
|
## API tokens
|
|
|
|
For scripts and tools: **Profile → API Tokens**. A token acts as its user and is shown once. Setting a user's password (as an administrator) deletes that user's tokens. Send it as a header:
|
|
|
|
```bash
|
|
curl -H "Authorization: Token wvc_..." https://<server>/api/v1/instances/
|
|
```
|
|
|
|
## Requests
|
|
|
|
- **Tags:** the VM and compute lists (also a compute's VMs) take `?tag=<name>`.
|
|
- **Jobs:** VM create, migrate and delete answer 202 with the job and need a `submission_key`: a new one for each operation, the same one to retry it (a delete retried after its VM is gone gets 404). `/api/v1/operations/` follows the jobs.
|
|
- **Errors:** a field the request got wrong answers with the fields. Any other error is `{"detail": ...}` with a status that says what it is: 404 for a VM, pool or volume read or deleted that the host does not have, 409 for a volume in use, a template started or a stopped pool, 503 for a host that cannot be reached. An unknown API URL answers JSON.
|