The HTTPClient object is a base object for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
Compared to the Inet object, the HTTPClient object is easier to use and supports more methods (Get/Post/Put/Delete) and more SSL protocols (TLS 1.0, TLS 1.1, TLS 1.2, TLS 1.3, SSL 2.0, and SSL 3.0).
Compared to RESTClient, HTTPClient can handle a wider range of API requests and more complex and hierarchical response data. However, if you want to work with RESTful Web Service APIs, RESTClient is recommended, as RESTClient is more efficient when handling APIs with simple flat response data.
The JSON string returned from the APIs must be in the format described in the section called “Supported JSON formats” in Application Techniques.
For how to transfer files or data via HTTPClient, refer to the section called “Transferring files with HTTPClient” in Application Techniques.
HTTPClient supports compression for the downloaded data, but not for the uploaded data. If the data received from the API is compressed, it will be automatically decompressed. Gzip and Brotli compression formats are supported. The developer can use the SetRequestHeader function to set the Accept-Encoding header to allow only the gzip or br compression format.
Note
It is not supported to use this object to process large data (20 MB or 100,000 data rows can be considered as large data based on our tests), because this object will call a third-party library which is memory intensive. If you want to process large data using HTTPClient, it is recommended that you disable the AutoReadData property (by default it is enabled) and use the ReadData function. View the code example in ReadData for how to process large data.
Note
This object uses your computer's proxy settings directly. It currently does not support enabling/disabling the proxy settings or configuring its own proxy.
Note
HTTPClient object (as well as RESTClient, CrypterObject, CoderObject, CompressorObject, DotNetAssembly, JSONGenerator, JSONParser, JSONPackage, OAuthClient, PDF Builder objects, SMTPClient, PowerServerLabel, PowerServerResult) does not support multi-threading.
HTTPClient property |
Datatype |
Description |
---|---|---|
Boolean |
Whether to allow the client to access the server anonymously. |
|
Boolean |
Whether to read the response body automatically. |
|
Boolean |
Checks if the server certificate is revoked. |
|
Boolean |
Whether to enable support for the HTTP2 connection when sending requests. |
|
Integer |
Ignores certain error(s) of the server certificate. |
|
Integer |
Specifies the security protocol. |
|
Long |
Specifies the timeout seconds. |
|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the object or control. |
HTTPClient event |
Occurs |
---|---|
Immediately before the Open event occurs in the window. |
|
Immediately after the Close event occurs in the window. |
HTTPClient function |
Datatype returned |
Description |
---|---|---|
String |
Returns the name assigned to the object. |
|
Integer |
Clears the client certificate that is set with SetClientCert. |
|
Integer |
Clears the headers of the request. |
|
Integer |
Creates a reference to a context-specific instance of the specified service. |
|
String |
Gets the HTTP protocol version used in communication. |
|
PowerObject |
Returns a reference to the name of the parent object. |
|
String |
Gets the request header by name. |
|
String |
Gets all of the request headers' information. |
|
Integer |
Gets the response body. |
|
String |
Gets the response header by name. |
|
String |
Gets all of the response headers' information. |
|
Long |
Gets the response status code. |
|
String |
Gets the response status description. |
|
Integer |
Gets the currently supported authentication scheme. |
|
Integer |
Sends the data with POST method. |
|
Integer |
Finishes sending the data with POST method. |
|
Integer |
Starts sending the data with POST method. |
|
Boolean |
Adds an event to the end of the message queue for the object. |
|
Integer |
Reads the response body. |
|
Integer |
Sends the request again. |
|
Integer |
Sends the request to the server. |
|
Integer |
Sets the client certificate that will be used to access the server. |
|
Integer |
Sets the current authentication credentials. |
|
Integer |
Sets the request header. |
|
Integer |
Sets all of the request headers' information. |
|
Integer |
Triggers a specific event in the object and executes the script for the event. |
|
Object |
Returns the type of the object. |