Skip to content

Commit

Permalink
Update API.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jfgiorgi committed Nov 8, 2022
1 parent 0ead200 commit 5422ad8
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions API.md
@@ -1,9 +1,11 @@
# NSpeed API (draft)
# NSpeed API (draft v 0.10)

The API is a minimalist "REST" API above HTTP.
It can use a dedicated endpoint or extend a 'server' command. In both case, the url is always '/api/v1'.
It can use a dedicated http server or extend a 'server' command. In both case, the path in the url always starts with `/api/v1/..`.

The currently available API URIs are `HTTP GET` requests only and are:
The currently available API endpoints are only with the `GET` verb and are:
### `/api/v1/help` and `/api/`
return this file
### `/api/v1/run/command/args...`
run job(s) , same as invoking `npeed` from the command line , pass arguments in the `args` query parameter.

Expand All @@ -26,5 +28,13 @@ return the server local time in human readable format
### `/api/v1/time/unix`
return the server local time in Unix time (= the number of seconds elapsed since January 1, 1970 UTC)

### `/api/v1/help` and `/api/`
return this file
### `/api/v1/stats/info[/field1[/field2[/...]]`
return some os/hardware informations about the host. either all infos or a selection of named fields.
for instances:
* `api/v1/stats/info` return all informations.
* `api/v1/stats/info/os` return the OS
* `api/v1/stats/info/os/platform` return the OS and the platform

### `/api/v1/stats/mem[/gc]`
return some memory informations about the host. Optionnally force a Go Garbage Collection by appending `gc`

0 comments on commit 5422ad8

Please sign in to comment.