Versions Compared

Key

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


Excerpt

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


Overloads

GetSquare9ApiClient Method#GetSquare9ApiClient()

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

GetSquare9ApiClient Method#GetSquare9ApiClient(string)

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



GetSquare9ApiClient() 
Anchor
GetSquare9ApiClient()
GetSquare9ApiClient()

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

Code Block
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 Block
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) 
Anchor
GetSquare9ApiClient(string)
GetSquare9ApiClient(string)

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

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