HttpClient Data Type

Provides a data type for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.

The following methods are available on instances of the HttpClient data type.

Method name Description
Clear() Sets the HttpClient variable to the default value.
GetBaseAddress() Gets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.
SetBaseAddress(String) Sets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.
DefaultRequestHeaders() Gets the default request headers which should be sent with each request.
Timeout([Duration]) Gets or sets the duration in milliseconds to wait before the request times out.
Get(String, var HttpResponseMessage) Sends a GET request to get the resource identified by the request URL.
Delete(String, var HttpResponseMessage) Sends a DELETE request to delete the resource identified by the request URL.
Post(String, HttpContent, var HttpResponseMessage) Sends a POST request to the specified URI as an asynchronous operation.
Put(String, HttpContent, var HttpResponseMessage) Sends a PUT request to the specified URI as an asynchronous operation.
Send(HttpRequestMessage, var HttpResponseMessage) Sends an HTTP request as an asynchronous operation.
AddCertificate(String [, String]) Adds a certificate to the HttpClient class.
UseDefaultNetworkWindowsAuthentication() Sets the HttpClient credentials to use the default network credentials for Windows authentication. If this method is invoked after any HTTP request has started; a runtime error occurs.
UseWindowsAuthentication(String, String [, String]) Sets the HttpClient credentials to use the specified network credentials for Windows authentication. If this method is invoked after any HTTP request has started; a runtime error occurs.

Remarks

The supported security protocols are controlled by the SecurityProtocol configuration setting. For more information, see Microsoft Dynamics 365 Business Central Server Configuration.

See Also

Getting Started with AL
Developing Extensions