Restart the engine in its own process (owner only): it applies the settings waiting for a restart and the settings file's edits. With dry_run, it says what a restart would do and whether it can.
const url = 'https://example.com/datanotes/restart/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"dry_run":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/datanotes/restart/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "dry_run": false }'The engine checks first that the next start will succeed: the folder exists, the settings file holds a JSON object the engine accepts, with an owner token, and the new port is free. When it would fail, the answer is 409 with the problems, and nothing stops. Otherwise it answers at once, then the requests under way finish and new ones get 503 (the engine is restarting). When a request still runs after 30 s, the restart is cancelled and the engine serves again (last_cancelled). The lock is kept. Poll the dry run until restarting is false: a new started_at then means the restart is done, the same one with last_cancelled that it was cancelled. The new engine answers a moment before it has finished starting, with a new started_at and restarting still true. A new port or owner token applies. A start that still fails ends the process with exit code 1. A named token is refused (403), even with maintain. A host that cannot restart does not serve the route (404).
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Only say what a restart would do.
Responses
Section titled “Responses”Done.
object
Always true in a 200 answer.
Whether this was only a dry run (nothing restarted).
A restart is under way (always true in the answer of a real restart).
No problem and no restart under way: a restart may start now.
Why the next start would fail, with what to do; empty when nothing would.
object
The settings whose value at the next start differs from what runs now (restart settings changed since the start, hand edits of the file), in settings order. Names only, never values.
Settings that differ too, but a start option of datanotes serve keeps winning.
object
The start option that wins, in words.
“
The port the engine listens on now.
The port after the restart (equal to port unless it changes).
When this run started (ISO; equals /status/ engine.started_at): a new value means the restart is done.
The engine’s process (a restart does not change it).
How the engine was started, as far as it can tell: what decides whether a failed start is started again.
The last restart of this run that was cancelled (a request still under way after the drain), with why.
object
Only in the answer of a real restart: when it was asked (ISO).
Example
{ "ok": true, "started_by": "systemd"}Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Missing or wrong bearer token.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A restart is already under way, or the next start would fail (problems): nothing stopped.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Unexpected error.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}