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.
rest
Authenticated ad-hoc REST call against the current instance.
sn rest <METHOD> <path> [--body <file>] [--body-inline <json>] [--raw] [--header "K: V"] [-v] Call an arbitrary REST endpoint on the current instance.
Arguments
| Name | Required | Description |
|---|---|---|
| METHOD | Yes | HTTP method (GET, POST, PUT, PATCH, DELETE). |
| path | Yes | Path relative to the instance host. Must start with / (e.g. /api/now/table/incident). |
Flags
| Flag | Default | Description |
|---|---|---|
| --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. |
| --raw | — | Send the body verbatim without attempting JSON parsing. |
| --header, -H | — | Extra header in `"Name: value"` form. Repeatable — one `--header` per entry. |
| --verbose, -v | — | Print method/path/status and response headers to stderr. |
Examples
sn rest GET /api/now/table/incident?sysparm_limit=1sn rest POST /api/sn_flow_diagram/flow_diagramming_api/getTranslatedFlow --body flow.jsonsn 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.