Skip to main content

api

api [get|post|put|patch|delete|head] [url] --data '{ "key": "value" }' --headers '{ "Authorization": "Bearer <token>"}'

Constructs and sends an http request.

arguments:​

method​

The HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD). (type: string)

url​

The url for the request. (type: string)

examples:​

Query​

api get http://api.crul.com/examples

Query​

api post http://api.crul.com/examples --data '{"bobby": "billy"}'

Query​

api put http://api.crul.com/examples --data '{"bobby": "billy"}'

Query​

api patch http://api.crul.com/examples/1 --data '{"bobby": "billy"}'

Query​

api delete http://api.crul.com/examples/1

flags:​

--appendStage​

Used to append the results from a previous stage to the current stage. (provide a label, stage index, or boolean true to append the previous results)

--bearer​

Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name β€œBearer authentication” can be understood as β€œgive access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request.

--cache​

A boolean value of true/false that determines whether or not to use the cache. Generally most commands will default to true.

--checkpoint​

Format: "{CHECKPOINT NAME}:{COLUMN}" Used to store the value of the provided column (in the first row of results) in the provided name for use as a checkpoint in scheduled queries or other stages. Not encrypted. Can be accessed using $CHECKPOINTS.{CHECKPOINT NAME}$

--credentials.aws4​

Provider reference stored in vault. Contains the provider and auth related information. Signs the HTTP request following the AWS Signature Version 4 specification.

--credentials.oauth​

Provider reference stored in vault. Contains the provider and auth related information.

--credentials.recordedfuture​

Provider reference stored in vault. Contains the provider and auth related information. Sets the HTTP request header X-RFToken following the Recorded Future authentication specification.

--data​

Data to send in the body of the request.

--data.encoding​

Data encoding format. JSON (default) or raw for direct pass-thru.

--enrich​

Enriches each result row with the previous row. The previous columns will be appended with a _previous.

--filter​

A filter to run on the command results before completing the command. If not provided, no filter is run on the results.

--fresh​

Starts the stage as if it was a fresh query, so will not use any previous result.

--guid​

Adds a populated random guid column.

--headers​

Headers to send in the request based --headers.format.

--headers.format​

Header format. JSON (default) or RFC2068.

--labelStage​

Used to label a stage with a user provided label.

--maxConcurrent​

Override for the system max concurrent workers for a stage.

--pagination.argIndex​

The index of the argument to store the pagination context.

--pagination.argKey​

The key to store the pagination context in the argument (assumes key value is JSON).

--pagination.done​

The value of pagination.next thats indicates that pagination is complete.

--pagination.filter​

Filter the results using a filter expression.

--pagination.flag​

The flag to store the pagination context.

--pagination.flagKey​

The key to store the pagination context in the flag (assumes key value is JSON).

--pagination.max​

Maximum number of pages visited.

--pagination.next​

The location within the results set describing the location of the next set of results. If not a complete URL, use the --pagination.url to construct the url using a token

--pagination.next.encode​

Specify one of ["raw" (default)|"urlencode"] to apply specified encoding to pagination.next token.

--pagination.url​

The url of the next set of results, which can include a token to substitute in the value selected by --pagination.next. If blank, the url is assumed to be contained in the value described by --pagination.next

--params​

Parameters to send in the query string for the request.

--proxy​

The URI for a http, https, socks(v5), socks5, socks4, or pac proxy.

--randomizeHash​

Randomizes the stage hash, even if args and flags are the same.

--redirect​

Set to manual to extract redirect headers, error to reject redirect or follow.

--request​

Include request metadata including headers, method, etc...

--response​

Include response metadata including headers, method, etc...

--serializer​

The serializer to use on response data. 'auto' (default) - Automatically serialize based on the response content-type.

serializercontent-type/mapppingdescription
jsonapplication/jsonJSON parse the response text and serialize the response content as a JSON string.
xmlapplication/xmlXML parse the response text and serialize to JSON format.
csvtext/csvCSV parse the response text and serialize to JSON format.
yamlapplication/x-yamlYAML parse the response text and serialize to JSON format.
text/vnd.yaml
text/yaml
text/x-yaml
texttext/plainSerialize the response content as a utf8 string assigned to a content attribiute (e.g., { content: <String> }).
zipapplication/zipList the files/entries inside the zip archive. See the unzip.path flag to read/serialize file contents.
octetstreamapplication/octet-streamA binary file. Serialization is derived from the file extension.
nonen/aSkip reading the body stream and skip serialization. This is a fast path for request and response metadata processing.

--stats​

Controls if a stats calculation is run on a stage after it completes.

--table​

A comma separated list of columns to include in the command results. If not provided, all columns will be included.

--token.access_token​

Sets the bearer authentication header (see --bearer) and propogates the token.access_token value to results.

--type​

Each command has a default type, either "mapping" or "reducing". Some commands can operate as either, when "reducing" they will operate on all rows at once, when "mapping", they will operate on one row at a time.

--unzip.path​

Unzip the matching file/entry path and serialize automatically (based on the inferred content-type).

--user​

Specify the user name and password to use for server authentication split up on the first colon.

--useragent​

The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent. <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent>

--variable​

Format: "{VARIABLE NAME}:{COLUMN}" Used to store the value of the provided column (in the first row of results) in the provided name for use as a variable in other stages. Can be accessed using $VARIABLES.{VARIABLE NAME}$. Stored as an encrypted secret. Not stored across queries.

--verifySSL​

Will skip SSL cert verification if set to false.

--while​

Will rerun the stage until the provided expression is valid for the first line of results.

support​

AMI_ENTERPRISE AMI_FREE AMI_PRO BINARY_ENTERPRISE BINARY_FREE BINARY_PRO DESKTOP_ENTERPRISE DESKTOP_FREE DESKTOP_PRO DOCKER_ENTERPRISE DOCKER_FREE DOCKER_PRO