Skip to main content
Skip table of contents

GetSquare9ApiClient Method

Gets an HttpClient object configured to make calls to a Square9Api.

Overloads

Gets an HttpClient object configured to make calls to the Square9 API associated with the executing GlobalAction workflow.

Gets an HttpClient object configured to make calls to a Square9 API associated with a specific Square9 API Portal.



GetSquare9ApiClient() 

Gets an HttpClient object configured to make calls to the Square9 API associated with the executing GlobalAction workflow.

CODE
public HttpClient GetSquare9ApiClient();

Classes: ActionEngine

Returns

HttpClient

HttpClient associated with the executing engine.

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. 

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

CODE
public HttpClient GetSquare9ApiClient(int square9ApiPortalId);

Classes: ActionEngineCaptureEngineEngine

Parameters

value string

ID of the Square9 API portal.

Returns

HttpClient

HttpClient associated with the executing engine.

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. 

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

JavaScript errors detected

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

If this problem persists, please contact our support.