HTTP Agent - C Sharp
Send HTTP request to a HTTP endpoint and fetch the response.
Logic Type | Available |
---|---|
Generic logic | ✅ |
Aggregator logic | ❌ |
HTTP Agent Configuration
See: Agent Configuration
A HTTP Agent Configuration defines an external HTTP host that will be allowed to be accessed from LOC runtime.
The HTTP Agent requires a configuration reference name so that it can access external endpoints on the host. The reference name can be added to a logic while creating or editing a data process.
Import and Usage
The agent can be used without using additional namespaces:
public static class Logic
{
public static async Task Run(Context ctx)
{
var httpClient = await HttpAgent.Acquire("http-config-ref");
var response = await httpClient.Send("/api/path");
}
public static async Task HandleError(Context ctx, Exception error)
{
// ... same
}
}
Class Reference
Type
HttpAgent