HTTP/2 Functions
The HTTP/2 functions are used to exchange data over HTTP/2 as a client. However, the functions can also be used for HTTP/1.
The client functions are used to exchange data with a HTTP server. There are specific functions for GET and POST as well as functions for general HTTP requests. Either plain text or encrypted communication can be used. Basic authentication is supported, as well as the use of a keystore, and if required a truststore, for the functions with an encrypted communication channel.
Note!
In all parameter descriptions below, "HTTP" may refer to both HTTP and HTTPS, and both HTTP/1 and HTTP/2.
The following functions for HTTP/2 described here are:
httpGet
This function uses the GET method to retrieve content from an HTTP server, see Response(9.2).
Response httpGet
( string host,
string path,
string protocol, //Optional
int port, //Optional
boolean secure, //Optional
int requestTimeout, //Optional
int connectionTimeout, //Optional
string username, //Optional
string password, //Optional
map<string, string> headers ) //OptionalParameter | Description |
|---|---|
| The name or IP address of the HTTP server. |
| The path. Example - path/api/v2/doc
|
| The protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2". |
| The port number to contact the HTTP server on. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default. |
| Indicates whether the data should be sent in secure mode or not. |
| The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds. |
| The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds. |
| A username for an account on the HTTP server. |
| Password associated with the username. |
| Custom HTTP request headers. |
Returns | A response from the HTTP server. It will be |
httpPost
This function uses the POST method to send content to an HTTP/2 server and receives the response.
Response httpPost
( string host,
string path,
bytearray content,
string contentType,
string protocol, //Optional
int port, //Optional
boolean secure, //Optional
int requestTimeout, //Optional
int connectionTimeout, //Optional
string username, //Optional
string password, //Optional
map<string, string> headers ) //Optional
Parameter | Description |
|---|---|
| The name or IP address of the HTTP server. |
| The path Example - path/api/v2/doc
|
bytarray | The body of the request in bytearray format. |
| The MIME type of the content. Example - contentTypeapplication/json
|
| The protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2". |
| The port number to contact the HTTP server on. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default. |
| Indicates whether the data should be sent in secure mode or not. |
| The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds. |
| The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds. |
| A username for an account on the HTTP server. |
| Password associated with the username. |
| Custom HTTP request headers. |
Returns | A response from the HTTP server. It will be |