.NET
The recommended way to integrate with IGNOS APIs is to use the official API client which is available on NuGet.
Installation
Install it from NuGet package manager in Visual studio or from the command line:
dotnet add package Ignos.Api.Client
Usage
There are several ways to configure the C# client, but the preferred way is to use the following set of extension methods:
services
.AddIgnosHttpClient(configuration)
.AddAzureAuthenticationHandler()
.AddDefaultPolicyHandler();
services.AddIgnosApiClient<ICountriesClient, CountriesClient>();
// Add more clients using services.AddIgnosApiClient as needed
This will automatically look for a configuration section named IgnosApi
(can be overriden with the configSectionName
argument).
The section will be bound to IgnosApiClientOptions
which has the following properties:
public class IgnosApiClientOptions
{
public string TenantId { get; set; }
public string ClientId { get; set; }
public string ClientSecret { get; set; }
public string Scope { get; set; }
public string BaseUrl { get; set; }
}
For other ways to configure the client(s), have a look at the source code or use intellisense to explore the API.
AddIgnosHttpClient
will add a namedHttpClient
that will be used for all communication with the Ignos API.AddAzureAuthenticationHandler
will add a delegating handler to the named HTTP client using an instance ofIConfidentialClientApplication
configured according to the provided config.AddDefaultPolicyHandler
will add aPolly
policy handler that will retry request on transient errors as well as429 Too Many Requests
.