HTTP - Post
Declaration
<AMHTTP ACTIVITY="post" SESSION="text" URL="text" TYPE="text (options)" FILEFIELD="text" DATA="text" QUERYSTRING="YES/NO" AUTHENTICATION="text (options)" USERNAME="text" PASSWORD="text (encrypted)" CERTIFICATE="text" CERTIFICATEPASSPHRASE="text" IGNOREINVALIDCERTIFICATE="YES/NO" VERSION="text (options)" SSLVERSION="text (options)" CONTENTTYPE="text" USERAGENT="text" TIMEOUT="number" MEASURE="text (options)" COOKIE="text (options)" COOKIEFILE="text" OVERWRITECOOKIEFILE="YES/NO" ENCODEURL="YES/NO" RESULTVARIABLE="text" RESULTDATASET="text" PROXYTYPE="text (options)" PROXYSERVER="text" PROXYPORT="number" PROXYUSERNAME="text" PROXYPASSWORD="text (encrypted)"><HEADER NAME="text" VALUE="text" /><COOKIE NAME="text" VALUE="text" /></AMHTTP>
Description
Uploads data or a file to the specified server.
Practical usage
Used to upload data or a file to the selected server. The difference between a PUT and POST request is reflected in the different meaning of the request URL.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Predefined connection | Text (options) | Yes | None | SESSION="HttpSession1" | Specifies the predefined connection to use with this request. Predefined connections are created using the HTTP - Define activity. If set to None, the connection settings are stored in the Credentials section of this activity. |
URL | Text | Yes | (Empty) | URL="https://www.google.com" | Specifies the URL of the server to use to upload data or a file. |
Post type | Text (options) | No | Text |
|
Specifies
the type data to post. The available options are:
|
Text | Text | Yes, if Post type is set to Text | (Empty) | DATA="The text string" | Specifies the text string of data to post. This parameter becomes active and is required if the Post type parameter is set to Text. |
Query string | Yes/No | No | (Empty) | QUERYSTRING="YES" | If selected, query strings are used with the text string. This parameter is active only if the Post type parameter is set to Text. |
File field | Text | Yes, if Post type is set to Field | (Empty) | FILEFIELD="</html>" | Specifies the field (that is, HTML form data) to upload. This parameter becomes active and is required if the Post type parameter is set to Field. |
File path | Text | Yes, if Post type is set to File or Field | (Empty) | DATA="c:\temp\file.txt" | Specifies the file containing the field or form data to upload. If the Post type parameter is set to File, this parameter specifies the path and file name to post. This parameter becomes active and is required if the Post type parameter is set to File or Field. |
Request fields | Text | No | (Empty) |
|
Allows
custom fields to be added to the request. Required parameters
are:
|
Populate variable with result data | Text | No | (Empty) | RESULTVARIABLE="varName" | The name of the variable to populate with the results of the transmission. |
Create and populate dataset | Text | No | (Empty) | RESULTDATASET="theDataset" | The name of the dataset to populate with request and response data, as well as other relevant information about the action performed. More details regarding the fields that this dataset creates can be found below under Datasets. |
Credentials
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Authentication type | Text (options) | No | None |
|
Specifies the
type of authentication to use with this activity. The available
options are:
|
Username | Text | No | (Empty) | USERNAME="Coolguy" | A valid user name to use during the authentication. If the Authentication type parameter is set to None, this parameter is ignored. |
Password | Text | No | (Empty) | PASSWORD="encrypted" | The password to use during the authentication. If created in visual mode, this value is automatically encrypted. If the Authentication type parameter is set to None, this parameter is ignored. |
Certificate file | Text | No | (Empty) | CERTIFICATE="C:\Temp\certFile.pfx" | The
path and file name of the certificate file to use to validate the connection.
Click the folder icon to navigate to the specified certificate
file or enter the path and file name manually. Enter this information
if a Certificate Authority (CA) is used to identify one end or
both end of the transactions. Automate Desktop supports the following
certificate file types:
|
Passphrase | Text | No | (Empty) | CERTIFICATEPASSPHRASE="encrypted" | The passphrase to use to authenticate connection. A passphrase is a password that may comprise of a whole phrase. |
Ignore invalid server certificate | Yes/No | No | No | IGNOREINVALIDCERTIFICATE="YES" | If selected, specifies that this action ignores invalid certificates when connecting to a server using SSL. This option is disabled by default. |
Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Protocol version | Text (options) | No | HTTP 1.1 |
|
Specifies the
protocol version to use. The available options are:
|
Content type (optional) | Text | No | (Empty) | CONTENTTYPE="text/html" | The content type and subtype of the data or file to upload (for example, application/zip, text/csv, image/jpeg). |
SSL version | Text (options) | Yes |
TLS1, TLS1.1, TLS1.2, TLS1.3 |
|
Specifies the versions of SSL (Secure Sockets Layer) and/or TLS (Transport Layer Security) protocols to use to secure the connection to the server. To select multiple versions, manually enter and separate each version with a comma (see default setting). The available options are:
NOTE: For compatibility with most sites, it is recommended to use the default TLS1,TLS1.1,TLS1.2, TLS1.3 setting for this parameter. However, older sites may require SSL2 and/or SSL3. |
User agent | Text (options) | Yes | AutoMate | USERAGENT="text" | The user agent originating the request. A website may require a User Agent string to be sent to it for statistical purposes, tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations (the default User Agent entered is AutoMate). |
Timeout | Number | No | 100 | TIMEOUT="50" | The maximum time the step waits for a response from the HTTP server before failing with a time out error. It may be useful to increase this value when posting extremely large amounts of data or if waiting for a long transaction to complete. (default value is 100 seconds). |
Measure (unlabeled) | Text (options) | No | seconds |
|
The
time measurement corresponding to the value entered in
the Timeout parameter.
The available options are:
|
Cookie permission | Text (options) | No | Block |
|
Specifies
how this activity handles cookies sent to/from the server.
The available options are:
NOTE: HTTP cookies are used for authenticating, session tracking (state
maintenance), and maintaining specific information about users. |
Encode URL | Yes/No | No | No | ENCODEURL="YES" | If selected, encodes the URL by converting non-compliant characters to ASCII format (for example, a space in a URL is converted to %20). |
Cookie file | Text | No | (Empty) | COOKIEFILE="c:\theFile" | The cookie file to use with this activity to identify and/or authenticate a server-based session. Cookies can be stored in different locations, depending on the version of explorer and Windows you are using. This parameter is not available if the Cookie permission parameter is set to Block. |
Overwrite cookie file | Yes/No | No | No | OVERWRITECOOKIEFILE="yes" | HTTP requests and responses are written to the same cookie file. By default, new request/response data is appended at the end of the cookie file as a new line. If this parameter is selected, new request/response data will overwrite existing data. Overwriting is a good way to minimize the size of a cookie file. This parameter is disabled by default. |
Request header(s) | Text | No | (Empty) |
|
Allows
entry of custom HTTP headers to the request. Required parameters
are:
|
Request cookie(s) | Text | No | (Empty) |
|
Allows
entry of custom HTTP cookies to the request. Request cookies can
be used in conjunction with cookie files. Required parameters
are:
|
Proxy type | Text (options) | No | System default |
|
Specifies the proxy type for Automate Desktop to use
when attempting network communications through a proxy server. The available options are:
NOTE:
|
Proxy server | Text | Yes, if Proxy type is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP | (Empty) |
|
The hostname (server.domain.com) or IP address of the proxy server. This parameter is only available and required if the Proxy type parameter is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP. |
Proxy port | Number | Yes, if Proxy type set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP | 1028 | PROXYPORT="3000" | The proxy port number to use to connect to the proxy server. Most proxy servers operate on port 1028 ( default), however, a proxy server can operate on other ports. This parameter is only available and required if the Proxy type parameter is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP. |
Proxy username (optional) | Text | No | (Empty) | PROXYUSERNAME="username" | The username to use to authenticate when connecting through the proxy server. This parameter is only available if Proxy type is set to SOCKS 5 or HTTP. |
Proxy password (optional) | Text | No | (Empty) | PROXYPASSWORD="text (encrypted)" | The password corresponding with the Proxy username parameter to use to authenticate when connecting through the proxy server. This parameter is encrypted in Task Builder. This parameter is only available if Proxy type is set to SOCKS 5 or HTTP. |
Additional notes
Datasets
A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).
Name | Type | Return Value |
---|---|---|
theDataset.RequestHeader | Text | Returns the request header. The header fields define various characteristics of the data transfer that is requested or the data that is provided in the message body. HTTP request header fields contain the parameters of an HTTP request operation. |
theDataset.RequestCookies | Text | Gets a collection of cookies sent by the client. |
theDataset.Data | Text | The progress of the snapshot, in percentage. |
theDataset.ResponseHeader | Text | Returns the response header. HTTP response header fields contain the parameters of an HTTP response operation. |
theDataset.ResponseCookies | Text | Gets the response cookie collection. |
theDataset.Log | Text | Provides a log of the transmission. |
Examples
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Example 1
Using connection settings stored within the HTTP - Post activity, this sample task posts search to the server, and then displays request header information and response header information in a dialog.
<AMHTTP ACTIVITY="post" URL="http://www.fortra.com" TYPE="field" RESULTDATASET="myDataset"><HEADER NAME="search" VALUE="automate" /><FIELD NAME="Search" VALUE="automate" /></AMHTTP>
<AMSHOWDIALOG>Request Header Info - %myDataset.RequestHeader%Response Header Info - %myDataset.ResponseHeader%</AMSHOWDIALOG>
Example 2
Using a predefined connection with the HTTP - Post activity, this sample task posts search to the server, and then displays request header information and response header information in a dialog.
<AMHTTP ACTIVITY="define" SESSION="HttpSession1" IGNOREINVALIDCERTIFICATE="YES" />
<AMHTTP ACTIVITY="post" SESSION="HttpSession1" URL="http://www.fortra.com" TYPE="field" RESULTDATASET="myDataset"><FIELD NAME="search" VALUE="automate" /></AMHTTP>
<AMSHOWDIALOG>Request Header Info - %myDataset.RequestHeader%Response Header Info - %myDataset.ResponseHeader%</AMSHOWDIALOG>