HTTP - Define

Declaration

<AMHTTP ACTIVITY="define" SESSION="text (options)" BASEURL="text" AUTHENTICATION="text (options)" USERNAME="text" PASSWORD="text (encrypted)" TOKEN="text" KEY="text" VALUE="text" AUTHURL="text" TOKENURL="text" CLIENTID="text" CLIENTSECRET="text" SCOPE="text" PORT="number" PERSIST="text (encrypted)" CERTIFICATE="text" CERTIFICATEPASSPHRASE="text (encrypted)" 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" PROXYTYPE="text (options)" PROXYSERVER="text" PROXYPORT="number" PROXYUSERNAME="text" PROXYPASSWORD="text (encrypted)"><HEADER NAME="text" VALUE="text" /><COOKIE NAME="text" VALUE="text" /></AMHTTP>

Related Topics   

Description

Creates and stores a predefined connection to share with other HTTP activities.

Practical usage

Used to create a predefined connection to share with other HTTP activities, rather than duplicating and storing those settings within each individual HTTP activity.

Parameters

General

Property Type Required Default Markup Description
Connection Name Text Yes HttpSession1 SESSION="HttpSession1" Specifies the name of the predefined connection to create.
Base URL (optional) Text No (Empty) BASEURL="www.google.com" Specifies the base URL on the server to use with the connection. This parameter is optional.
Authentication type Text (options) No None
  • AUTHENTICATION="none"
  • AUTHENTICATION="basic"
  • AUTHENTICATION="digest"
  • AUTHENTICATION="ntlm"
  • AUTHENTICATION="bearer"
  • AUTHENTICATION="api_key"
  • AUTHENTICATION="Oauth"

Specifies the type of authentication to use. The available options are:

  • None (default) - No authentication will be used.
  • Basic - Based on a username and password, this is the authentication mechanism defined in the HTTP/1.0.
  • Digest - Like the Basic option, Digest Authentication authenticates a user based on a username and a password. However, the authentication is performed by transmitting the password in an encrypted form which is much more secure than the simple base64 encoding used by Basic Authentication.
  • NTLM - A challenge-response scheme, consisting of three messages, commonly referred to as Type 1 (negotiation), Type 2 (challenge) and Type 3 (authentication).
  • Bearer Token - Authenticates a user by way of a server generated bearer security token.
  • API Key - Authenticates a user by way of a server generated API key and unique value.
  • OAuth 2.0 - Authenticates a user by way of OAuth 2.0.
Test URL Text No (Empty) N/A If an Authentication type is selected, a test connection to the server can be executed using an HTTP GET request. Enter a URL on the server, the requested credentials, and then click Test Connection. The server will return a message. This parameter is optional and is not used in runtime.
Username Text Yes, if Authentication type is set to Basic, Digest, or NTLM (Empty) USERNAME="Coolguy" A valid user name to use during authentication. This parameter becomes active and is required if Authentication type is set to Basic, Digest, or NTLM.
Password Text Yes, if Authentication type is set to Basic, Digest, or NTLM (Empty) PASSWORD="encrypted" The password to use during authentication. If created in visual mode, this value is automatically encrypted. This parameter becomes active and is required if Authentication type is set to Basic, Digest, or NTLM.
Token Text Yes, if Authentication type is set to Bearer Token (Empty) TOKEN="ServerAuthorizationToken" The server generated bearer token to use during authentication. This parameter becomes active and is required if Authentication type is set to Bearer Token.
Key Text Yes, if Authentication type is set to API Key (Empty) KEY="ServerAuthorizationKey" The server generated API key to use during authentication. This parameter becomes active and is required if Authentication type is set to API Key.
Value Text Yes, if Authentication type is set to API Key (Empty) VALUE="ServerAuthorizationValue" The server generated API key value to use during authentication. This parameter becomes active and is required if Authentication type is set to API Key.
Authorization URL Text Yes, if Authentication type is set to OAuth 2.0 (Empty) AUTHURL="https://accounts.google.com/auth" The authorization URL to use during authentication. This parameter becomes active and is required if Authentication type is set to OAuth 2.0.
Access Token URL Text Yes, if Authentication type is set to OAuth 2.0 (Empty) TOKENURL="https://accounts.google.com/token" The access token URL to use during authentication. This parameter becomes active and is required if Authentication type is set to OAuth 2.0.
Client ID Text Yes, if Authentication type is set to OAuth 2.0 (Empty) CLIENTID="ServerGeneratedID" The client ID to use during authentication. This parameter becomes active and is required if Authentication type is set to OAuth 2.0.
Client Secret Text No (Empty) CLIENTSECRET="encrypted" The client secret to use during authentication. This parameter becomes active and is optional if Authentication type is set to OAuth 2.0.
NOTE: Not all servers require a secret to accompany the client ID.
Authorization Scope Text No (Empty) SCOPE="https://www.googleapis.com/profile" Specifies the authorization scopes to limit access to resources on the server. This parameter becomes active and is optional if Authentication type is set to OAuth 2.0.
Local machine callback listening port number Text Yes, if Authentication type is set to OAuth 2.0 8080 PORT="8080" Specifies the open port number on the local machine for Automate Desktop to use to receive the access token. This parameter becomes active and is required if Authentication type is set to OAuth 2.0.
Persist Token Text No Yes PERSIST="GUID" If selected, writes the token information to disk to persist the OAuth 2.0 connection to the server. This parameter becomes active and is optional if Authentication type is set to OAuth 2.0.

Credentials

Property Type Required Default Markup Description
Certificate file Text No (Empty) CERTIFICATE="C:\Temp\certFile.pfx" The path and file name of the certificate file used to validate 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:
  • Internet Security Certificate (.cer) - Security file provided by a third party such as VeriSign or Thwate that confirms the authenticity of a Web site; installed on a Web server (such as Apache or Windows Advanced Server) to authenticate the validity of a certain website hosted on the server.
  • Privacy Enhanced Mail Certificate (.pem) - Base64-encoded certificate file, such as a PEM-encoded X509 certificate; used to authenticate a secure website; typically imported from a Unix-based Apache Web server and compatible with OpenSSL applications. PEM certificate files are generated automatically and are not meant to be opened or edited manually.
  • PKCS #12 Certificate File (.pfx) - Encrypted security file that stores secure certificates used to authenticate a person or device, such as a computer or Web server; requires a password to be opened; can be installed by right-clicking the file and selecting "Install PFX."
  • Personal Information Exchange (.p12) - SSL certificate used to authenticate a secure website on a Microsoft IIS Web server.
Passphrase Text No (Empty) CERTIFICATEPASSPHRASE="encrypted" The passphrase to use to authenticate the 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 while 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
  • VERSION="HTTP10"
  • VERSION="HTTP11"
Specifies the protocol version to use. The available options are:
  • HTTP 1.0 - Uses a separate connection to the same server for every request-response transaction.
  • HTTP 1.1 - Can reuse a connection multiple times allowing less latency.
Content type (optional) Text No (Empty) CONTENTTYPE="text/html" The content type and subtype of the text or file to use with the intended request (for example, application/zip, text/csv, image/jpeg).
SSL version Text (options) Yes

TLS1, TLS1.1, TLS1.2, TLS1.3

  • SSLVERSION="SSL2"
  • SSLVERSION="SSL3"
  • SSLVERSION="TLS1"
  • SSLVERSION="TLS1.1"
  • SSLVERSION="TLS1.2"
  • SSLVERSION="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:
  • SSL2
  • SSL3
  • TLS1
  • TLS1.1
  • TLS1.2
  • TLS1.3
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 that the step should wait 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
  • MEASURE="milliseconds"
  • MEASURE="seconds"
  • MEASURE="minutes"
  • MEASURE="hours"
The time measurement that should correspond to the value entered in the Timeout parameter. The available options are:
  • Milliseconds - Timeout value set to milliseconds.
  • Seconds (default) - Timeout value set to seconds.
  • Minutes - Timeout value set to minutes.
  • Hours - Timeout value set to hours.
Cookies permission Text (options) No Block
  • COOKIE="block"
  • COOKIE="read"
  • COOKIE="write"
  • COOKIE="allow"
Specifies how this activity handles cookies sent to/from the server. The available options are:
  • Block - Block cookies sent by the server. Note that specific servers may require cookies.
  • Read - Allow cookies sent by the server to be read onto a specific file.
  • Write - Allow a specific cookie file to be sent to the server.
  • Allow - Allow both read and write options to be performed.
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" 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 Cookies to/from file 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)
  • NAME="theName"
  • VALUE="theValue"
Allows entry of custom HTTP headers to the request. Required parameters are:
  • Name - String that specifies the header name.
  • Value - String that specifies the header value.
Request cookie(s) Text No (Empty)
  • NAME="theName"
  • VALUE="theValue"
Allows entry of custom HTTP cookies to the request. Request cookies can be used in conjunction with cookie files. Required parameters are:
  • Name - String that specifies the cookie name.
  • Value - String that specifies the cookie value.
Proxy type Text (options) No System default
  • PROXYTYPE="none"
  • PROXYTYPE="socks4"
  • PROXYTYPE="socks4a"
  • PROXYTYPE="socks5"
  • PROXYTYPE="http"
Specifies the proxy type for Automate Desktop to use when attempting network communications through a proxy server. The available options are:
    System default - Uses the default configurations set for Proxy in the Default Properties section of the Task Administrator (Options > Default Properties > Proxy).
  • None - Explicitly instructs the action not to use a proxy server regardless of the system default.
  • SOCKS 4 - Instructs the action to go through a SOCKS 4-compliant server.
  • SOCKS 4a - Instructs the action to go through a SOCKS 4a -compliant server.
  • SOCKS 5 - Instructs the action to go through a SOCKS 5-compliant server.
  • HTTP - Instructs the action to go through an HTTP-compliant server.
NOTE:
  • To create the most portable tasks, it is recommended to select System default and specify proxy settings globally in the Default Properties section. By proceeding in this manner, tasks created in one environment that may have a proxy server will be portable to others that do not, and vice-versa.
  • If you are unsure of the value to use in this parameter, contact your network administrator.
Proxy server Text Yes, if Proxy type is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP (Empty)
  • PROXYSERVER="proxy.host.com"
  • PROXYSERVER="xxx.xxx.xxx.xxx"
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.

Description

Error Causes

On Error

Example

NOTE:
  • 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.

Description

Using a predefined connection with the GET request, this sample task gets content from the server and then displays result data, request header information, and response header information in a dialog. Then, the task clears the connection information.

Copy
<AMVARIABLE NAME="myVar" VALUE="" />
<AMHTTP ACTIVITY="define" SESSION="HttpSession1" AUTHENTICATION="basic" USERNAME="myUsername" PASSWORD="AM5oDoxAdt+QDxeXhPeW9NBCmdsy6+Csc4EVMzS49H547I=aME" IGNOREINVALIDCERTIFICATE="YES" />
<AMHTTP SESSION="HttpSession1" URL="http://www.fortra.com" RESULTDATASET="myDataset" RESULTVARIABLE="myVar" />
<AMSHOWDIALOG>Request Header Info - %myDataset.RequestHeader%Response Header Info - %myDataset.ResponseHeader%</AMSHOWDIALOG>
<AMHTTP ACTIVITY="clear" SESSION="HttpSession1" />