GetSquare9ApiClient Method
Gets an HttpClient object configured to make calls to a Square9Api.
Overloads
GetSquare9ApiClient()Â
Gets an HttpClient object configured to make calls to the Square9 API associated with the executing GlobalAction workflow.
public HttpClient GetSquare9ApiClient();
Classes:Â ActionEngine
Example
The following example demonstrates retrieving database information from an HttpClient object connected with the Square9 API referenced by the executing GlobalAction workflow. 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 Square9 API.Â
using (var square9Api = Engine.GetSquare9ApiClient()) { var response = square9Api.GetAsync("dbs").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 Square9 API client interactions within a "using" block, or manually call the "Dispose()" method to close the connection when you are done interacting with the Square9 API.
GetSquare9ApiClient(string)Â
Gets an HttpClient object configured to make calls to a Square9 API associated with a specific Square9 API Portal.
public HttpClient GetSquare9ApiClient(int square9ApiPortalId);
Classes: ActionEngine, CaptureEngine, Engine
Parameters
value string
ID of the Square9 API portal.
Example
The following example demonstrates retrieving database information from an HttpClient object connected with the Square9 API associated with portal ID 1. 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 Square9 API.Â
using (var square9Api = Engine.GetSquare9ApiClient(1)) { var response = square9Api.GetAsync("dbs").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 Square9 API client interactions within a "using" block, or manually call the "Dispose()" method to close the connection when you are done interacting with the Square9 API.