Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

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


Code Block
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 Block
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.