Automation Action: HTTP Post
Post data to any web page or API.
Post data to a web resource using HTTP POST/PUT/PATCH or DELETE.
Specify the Post To URL of the http resource to post to.
Note: If you use %variable% replacements inside the URL - the variable values must be URL Encoded.
If the web resource requires authentication then specify the Authentication method and optionally a User Name/Password or an OAuth Auth Token retrieved from a previous OAuth SignIn action.
Select the Post Type you wish to perform. This can be:
- Regular POST - for posting form field values.
- Json POST - for posting Json data.
- Json PUT - for posting Json data using a HTTP PUT instead of POST.
- Json PATCH - for posting Json patch data.
- Custom - for performing custom HTTP Posts using data you specify.
- Stream Binary File - for binary POST/PUT of files.
- HTTP DELETE - for sending delete requests.
For regular Posts you can specify any number of Names and Values. The Values can be fixed or %fieldname% replacements or combinations of both. You can also specify a Type of Text (the default) or File (see Uploading Files below).
For JSON POST or PUT you must specify the JSON Text.
For Custom Posts you must specify the Custom data. This would be the body of the postdata - not the headers.
For all post types you can specify any Query String Parameters. These can either be specified in the URL itself or in the Query String Parameters grid. If you specify query string parameters in the grid any %variable% replacements will be automatically URL encoded.
For all post types you can specify any Custom Headers. Multiple header names & value pairs can be specified. Any existing HTTP headers will be replaced if you use a standard header.
You can specify the Connection Timeout (in seconds). This is the number of seconds to wait for the initial connection. The Response Timeout is the number of seconds to wait for a response after the post has been made.
The HTTP response status code, response headers & response body can also optionally be assigned to variables.
Uploading Files
You can upload files in two ways. Using the Regular Post option, or the Stream Binary File option. The choice will depend on the end point you are posting to.
Using the Regular Post option you can specify the Type as File against a specific form Post Value. The Value should then be a local file path (or a %variable% pointing to a file path). If the Name is not specified then the file name will be used. Adding files to a regular post will result in a POST content-type of 'multipart/form-data'.
Using the Stream Binary File option you specify a File Path. The file content will be posted and the content-type will be set based on the file extension.
Response Status
The HTTP response status code & response headers can also optionally be assigned to variables.
The status code will be the HTTP response status (200, 404 etc). A status code of <100 indicates a connection error (eg: 2 = 'DNS lookup failed', 3 = 'DNS lookup timeout', 6 = 'Connect timeout'). The error details will be added to the log.
If the Throw Error On HTTP Errors option is enabled then the Automation will log an error if the HTTP status is an error status (404, 500 etc). If this option is not enabled then an error will not be raised (the status will still be logged). This is useful if the purpose of your Automation is to check for HTTP errors. Note: Connection errors will always throw an error.