Skip to content

systemslab api

Description Make an authenticated HTTP request to the SystemsLab API.
Usagesystemslab api [OPTIONS] <ENDPOINT>

Description

The systemslab api command lets you make raw HTTP requests to any endpoint on the SystemsLab server. It is similar to gh api in concept: authentication is handled automatically using a cached OAuth token, so you do not need to manage credentials manually.

The <ENDPOINT> argument is a path relative to the server URL (e.g. api/v1/experiment).

sh
# GET request
systemslab api api/v1/experiment

# POST with JSON fields
systemslab api api/v1/submit -f name=my-experiment

# POST with raw JSON body from stdin
echo '{"name":"test"}' | systemslab api api/v1/submit --input -

# Custom method and headers
systemslab api api/v1/experiment/123 -X DELETE
systemslab api api/v1/submit -H "X-Custom: value" -f name=test

Options

OptionDefaultDescription
<ENDPOINT> The API endpoint to call (e.g. api/v1/experiment). This is a path relative to the SystemsLab server URL.
-X, --method <METHOD> The HTTP method to use. Defaults to GET, or POST when a request body is provided.
-H, --header <KEY:VALUE> Add an HTTP request header in key:value format. This flag can be provided multiple times to set multiple headers.
-f, --field <KEY=VALUE> Add a typed field to the JSON request body. Values that look like JSON (numbers, booleans, arrays, objects) are sent as their parsed type; everything else is sent as a string. This flag can be provided multiple times to set multiple fields.
-F, --raw-field <KEY=VALUE> Add a raw string field to the JSON request body. The value is always sent as a JSON string, even if it looks like a number or boolean. This flag can be provided multiple times to set multiple fields.
--input <FILE> Read the request body from a file. Use - to read from stdin.

Common Options

OptionDefaultDescription
--systemslab-url The URL at which to access the systemslab server.
--colorauto Controls when color is used in the output. Possible values are auto, always, and never.
--output-formatlong Output format to use when outputting messages. long will result output designed to be human-readable while short is short output meant to be used within scripts.

Environment Variables

VariableDescription
SYSTEMSLAB_URLSpecify the URL used to contact the SystemsLab server. Equivalent to --systemslab-url.