/
GetCaptureApiClient Method

GetCaptureApiClient Method

Gets an HttpClient object configured to make calls to the CaptureApi associated with the executing engine.

public HttpClient GetCaptureApiClient();

Classes: Engine


Returns

HttpClient

HttpClient associated with the executing engine.


Example

The following example demonstrates retrieving field catalog information from an HttpClient object connected with the CaptureApi referenced by the executing engine. The using block is significant in that at the conclusion of this example code, the Dispose() method is called in order to manually dispose of the HTTP connection to the Capture API. 

using (var captureApi = Engine.GetCaptureApiClient())
{
	var response = captureApi.GetAsync("fields").Result;
	var fieldsJson = response.Content.ReadAsStringAsync().Result;
}

Remarks

The HttpClient object is documented on Microsoft's .NET documentation website found here

It is important to prevent manage the lifetime of the returned HttpClient object. As the example on this page shows, wrap your Capture API client interactions within a "using" block, or manually call the "Dispose()" method to close the connection when you are done interacting with the Capture API.

Related content

CaptureEngine Class
CaptureEngine Class
More like this
GlobalCapture Updating GlobalSearch API References
GlobalCapture Updating GlobalSearch API References
More like this
Get JSON Node
Get JSON Node
More like this
CaptureDocument Class
CaptureDocument Class
More like this
Properties Class
Properties Class
More like this