api
Send a GET, POST, PUT, PATCH or DELETE to any customer endpoint, with this machine's credential.
stechbd api reaches any customer endpoint the panel has, with this machine's credential, the way gh api reaches GitHub. Use it for what no command covers yet. The path is relative to /api/v1. Every command also takes --json, --quiet and --help.
| Command | What it does |
|---|---|
stechbd api get | Send a GET to a customer endpoint |
stechbd api post | Send a POST, with a JSON body |
stechbd api put | Send a PUT, with a JSON body |
stechbd api patch | Send a PATCH, with a JSON body |
stechbd api delete | Send a DELETE |
Only customer endpoints in the API contract this CLI ships with are sent. An operator endpoint is refused before the request is made, and the refusal says the installation is managed from the dashboard. Each response is printed as JSON. A 204 prints nothing.
stechbd api get
Sends a GET and prints the JSON the panel returns. A GET is retried, because repeating a read is safe. --query adds key=value pairs to the query string, and may be given more than once. A --data body on a GET is refused, not dropped.
stechbd api get <path> [--query <key=value>]| Option | Description |
|---|---|
<path> | The endpoint path, such as /servers. A full URL is refused. Required. |
--query <key=value> | A query parameter. Repeatable. |
stechbd api get /servers
stechbd api get /apps/01J.../deployments --query limit=5stechbd api post
Sends a POST. The body is given with --data, as JSON text, as @file to read a file, or as - to read stdin. The body is parsed before anything is sent, so a JSON typo is reported and nothing reaches the panel. Only GET requests are retried.
stechbd api post <path> [--data <json|@file|->] [--query <key=value>]| Option | Description |
|---|---|
<path> | The endpoint path. Required. |
--data <json|@file|-> | The JSON body: inline text, @file to read a file, or - to read stdin. |
--query <key=value> | A query parameter. Repeatable. |
stechbd api post /tokens --data @token.json
echo '{"name":"blog"}' | stechbd api post /tokens --data -stechbd api put
Sends a PUT with a JSON body, read the same way as post. The body is parsed before anything is sent. Only GET requests are retried.
stechbd api put <path> [--data <json|@file|->] [--query <key=value>]| Option | Description |
|---|---|
<path> | The endpoint path. Required. |
--data <json|@file|-> | The JSON body: inline text, @file to read a file, or - to read stdin. |
--query <key=value> | A query parameter. Repeatable. |
# replace an application’s redirect and header rules with the contents of rules.json
stechbd api put /apps/01J.../rules --data @rules.jsonstechbd api patch
Sends a PATCH with a JSON body, read the same way as post. The body is parsed before anything is sent. Only GET requests are retried.
stechbd api patch <path> [--data <json|@file|->] [--query <key=value>]| Option | Description |
|---|---|
<path> | The endpoint path. Required. |
--data <json|@file|-> | The JSON body: inline text, @file to read a file, or - to read stdin. |
--query <key=value> | A query parameter. Repeatable. |
echo '{"name":"blog"}' | stechbd api patch /projects/01J... --data -stechbd api delete
Sends a DELETE. A DELETE takes no body, so --data is refused. Only GET requests are retried.
stechbd api delete <path> [--query <key=value>]| Option | Description |
|---|---|
<path> | The endpoint path. Required. |
--query <key=value> | A query parameter. Repeatable. |
stechbd api delete /tokens/01J...