GetCaptureApiClient Method
Gets an HttpClient object configured to make calls to the CaptureApi associated with the executing engine.
public HttpClient GetCaptureApiClient();
Classes:Â 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.