Skip to main content

api

api [get|post|put|patch|delete|head] [url]
api get [url]
api post [url] --data [json]
api put [url] --data [json]
api patch [url] --data [json]
api delete [url]

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. 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.

--data

data to send in the body of the request

--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

--labelStage

Used to label a stage with a user provided label.

--maxConcurrent

Override for the system max concurrent workers for a stage.

--pagination

If enabled, will allow for pagination (one api command will make multiple requests according to the pagination strategy described in pagination flags)

--pagination.dataKey

If the request is a POST operation and pagination is handled through the post body, the --pagination.dataKey flag is the key to add to the post data payload, where the value will be the value contained in the --pagination.next flag

--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.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

params to send in the query string for the request

--proxy

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

--request

include request data

--response

include response data

--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> }).

--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

--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>

--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