Http.Post¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
The input for this shard should either be none, string, bytes, or string table to send in the body of the POST request. | None {String} Bytes String |
||
Output ➡️ |
The output is the response from the server through the POST request as a string, byte array, or table (if the FullResponse parameter is set to true). | {status: Int headers: {String} body: Bytes} Bytes {status: Int headers: {String} body: String} String Object |
||
URL |
No | The url to request to. | `` | String Var(String) |
Headers |
No | If a table of headers is provided, it will be used as is; if no headers are provided, a Content-Type header will be derived based on the input type. | none |
None {String} Var({String}) |
Timeout |
No | How many seconds to wait for the request to complete. | 10 |
Int |
Bytes |
No | If instead of a string the shard should output bytes. | false |
Bool |
FullResponse |
No | If the output should be a table with the full response, including headers and status. | false |
Bool |
AcceptInvalidCerts |
No | If we should ignore invalid certificates. This is useful for testing but should not be used in production. | false |
Bool |
Retry |
No | How many times to retry the request if it fails. | 0 |
Int |
KeepAlive |
No | If the client instance should be kept alive, allowing connection reuse for multiple requests. The client won't be closed until this shard cleans up. | false |
Bool |
Streaming |
No | If the response should be streamed, in which case the output will be an object to use with the Http.Stream shard. | false |
Bool |
Backoff |
No | How many seconds to wait between retries. Defaults to 1 second. | 1 |
Int |
This shard sends a HTTP POST request to the specified URL and outputs the response.
Details¶
A HTTP POST request is a method of sending data to a server to create a resource.
This request is not idempotent. Multiple identical requests might create multiple resources.
This shard can accept a string table, string or bytes as input and will modify the body of the POST request accordingly. - none : no body is attached to the request - string : The string is attached to the body as is and treated as a JSON string. - string table : Both key and values need to be strings. The shard constructs a URL encoded string using the key and value pairs from the table and attaches it to the body of the request. - bytes : The bytes are attached to the body as is.
If the output of the shard is a table, it will have the following format:
{
status: @type(Type::Int)
headers: {header: @type(Type::String)}
body: @type(Type::String) ;; or @type(Type::Bytes)
}