http
Command
The http
command sends objects in a payload to the defined HTTP(S) endpoint.
The shape and format of the object can be adjusted with commands such as list
, format
, jq
, etc.
tip
You can use the chunk
command to send chunks of objects:
Perform up to 3 requests, where every request will contain up to 10 elements
> search is(volume) limit 30 | chunk 10 | http test.foo.org
Usage
http [--compress] [--timeout <seconds>] [--no-ssl-verify] [--no-body] [--nr-of-retries <num>] [--auth <username>:<password>] <http_method> <url> <headers> <query_params>
Parameters
Parameter | Description | Required? | Default Value |
---|---|---|---|
http_method | HTTP request method (GET , PUT , POST , DELETE , or PATCH ) | ❌ | POST |
url | URL endpoint to which the request should be sent * | ✔️ | |
headers | HTTP request headers (e.g., HeaderA:value1 HeaderB:value2 "HeaderC:value with whitespace" ) | ❌ | |
query_params | HTTP request query parameters (e.g., param1==value2 param2==value2 "param3==value with whitespace" ) | ❌ |
* If a URL scheme is not present, it will be determined by whether or not the http
command or the https
command alias was used. Additionally, localhost
can be omitted from url
(e.g., :8080/call/me
).
Options
Option | Description | Required? |
---|---|---|
--compress | Compress request body | ❌ |
--timeout <seconds> | Maximum timeout in seconds (aborts request if exceeded) | ❌ |
--no-ssl-verify | Disable SSL certificate verification | ❌ |
--no-body | Send with empty request body | ❌ |
--nr-of-retries | Maximum number of retries for unsuccessful requests (non-2XX HTTP status codes) * | ❌ |
--auth | Basic authentication username and password | ❌ |
* By default, requests are retried three times. There is an exponential backoff between retries.
Aliases
https
Examples
Look for unencrypted volumes and report them to the specified endpoint
> search is(volume) and reported.volume_encrypted==false | https my.node.org/handle_unencrypted
3 requests with status 200 sent.
Query all volumes and send chunks of 50 volumes per request to the specified handler
> search is(volume) | chunk 50 | https --compress my.node.org/handle
2 requests with status 200 sent.
Same as previous, but define special header and query parameter values
> search is(volume) | chunk 50 | https my.node.org/handle "greeting:hello from fixcore" type==volume
2 requests with status 200 sent.