sndev.io / docs

rest

Authenticated ad-hoc REST call against the current instance.

The rest command is your escape hatch for any endpoint outside /api/now/table/. sn get / sn update cover Table API; sn rest covers everything else — scripted REST APIs, internal endpoints, or anything you'd reach for curl for. Authentication is handled automatically from your .env credentials. Response body goes to stdout; non-2xx status exits with code 2.

sn rest <METHOD> <path> [--body <file>] [--body-inline <json>] [--raw] [--header "K: V"] [-v]

Call an arbitrary REST endpoint on the current instance.

Arguments

NameRequiredDescription
METHODYesHTTP method (GET, POST, PUT, PATCH, DELETE).
pathYesPath relative to the instance host. Must start with / (e.g. /api/now/table/incident).

Flags

FlagDefaultDescription
--body <file>Read request body from file. Parsed as JSON unless `--raw` is set; non-JSON passes through as-is.
--body-inline <json>Pass the request body as an inline string.
--rawSend the body verbatim without attempting JSON parsing.
--header, -HExtra header in `"Name: value"` form. Repeatable — one `--header` per entry.
--verbose, -vPrint method/path/status and response headers to stderr.

Examples

sn rest GET /api/now/table/incident?sysparm_limit=1
sn rest POST /api/sn_flow_diagram/flow_diagramming_api/getTranslatedFlow --body flow.json
sn rest POST /api/now/x --body-inline '{"foo":"bar"}' -H "X-Transaction-Source: test"

sn rest reuses your authenticated session — it will happily hit any endpoint the account has reach to. Treat it like a shell and review your flags before running, especially for POST/PUT/DELETE.