Skip to main content
Skip table of contents

GetCaptureApiClient Method

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

CODE
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. 

CODE
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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.