# Clients and versions

Anything that talks to a wall other than its own page is a client of [the API](https://qkvm.com/docs/web/the-api). These rules keep it working from one version of qKVM to the next, saying the same things the page says.

## The rules

1. **Ask `GET /healthz` first.** It needs no sign-in. `api` lists the versions of the interface the wall speaks: where `v1` is not listed, say so plainly and send nothing else. `locked` says the wall reaches no device until somebody signs in.
2. **Take what you know, leave the rest.** Within `v1` nothing is taken away. A state or code you have not met is shown as a problem, with the sentence the wall sent; a word of `can` you have not met is left out.
3. **Go by `can`, never by the kind of device.** A new kind of device brings new words, and a client that goes by `can` shows the right buttons for it without having heard of it.
4. **Use the wall's words.** `words.json`, served by every wall at `/static/words.json`, holds the states and their labels, device trouble codes, refusal codes with their statuses, the kinds of device, and the words of `can`. Build from it, or check against it.
5. **Leave the page's own to the page.** Setting a wall up, its settings, accounts, Web Push and updates are done in a browser.

## Check a wall

`qkvm.conformance` holds a running wall to the promise of the API. It only reads: it sends nothing but GET, and opens no live line and no console.

```
python -P -m qkvm.conformance https://192.168.1.20:8787 --token-file token.txt --cafile cert.pem
```

| Option | What it does | Default |
|---|---|---|
| `--token-file` | a file holding a viewer's or operator's token for scripts, alone on one line | required |
| `--cafile` | the wall's own certificate, `tls/cert.pem` from its data folder | public authorities |
| `--every-machine` | reads every machine, not one of each kind | off |
| `--no-pictures` | asks for no picture | off |
| `--strict` | expects all of it, whatever the wall's version | off |

- The token is sent to that wall alone and never written out. Over plain HTTP, the check says the token crossed the network unencrypted.
- Behind a proxy that signs people in (`--sso-header`), check the wall's own address.
- A request or field promised since a later version than the wall's is skipped. One the wall added since is a `note`.

## What it says

A line for each thing it looked at (`ok`, `FAIL`, `note` or `skip`), and at the end how many of each.

| Exit status | Means |
|---|---|
| 0 | the wall answered everything as promised |
| 1 | it did not |
| 2 | could not check: out of reach, certificate not trusted, token not taken, wall locked, or older than 0.2.0 |

## In your release tests

Run the check from the qKVM version your client was written against (`pip install qkvm==<version>` in an environment of its own is enough). Run it against a wall of every version the client is to work with, set up with machines and a token for scripts. Stop the release on any exit status but 0.

## Related

- [The API](https://qkvm.com/docs/web/the-api)
- [API requests](https://qkvm.com/docs/web/api-requests)
- [Scripts and wall screens](https://qkvm.com/docs/web/scripts-and-wall-screens)
- [Updates](https://qkvm.com/docs/web/updates)

[Full reference](https://github.com/qkvm/qkvm/blob/main/GUIDE.md#clients-and-versions)
