C# SDK

Install and start using the C# SDK.

Intro

The InCountry REST API SDK provides access to the InCountry REST API REST APIs.

Store, query and manage regulated data in the InCountry Data Residency-as-a-Service (DRaaS) vault of a specific country.

Installation

Add the SDK as a project reference into your solution:

Terminal
dotnet add reference <path-to-sdk>/src/InCountryRestApi/InCountryRestApi.csproj

The project takes its build settings from the files around it, so reference it in place.

Quick Start

Dependency Injection

Register the client with IServiceCollection and resolve it from the container. The HttpClient is managed by IHttpClientFactory. Configure the client's behavior through InCountryRestApiClientOptions.

C#
services.AddInCountryRestApiClient(options =>
{
    options.BearerAuth = "YOUR_BEARER_TOKEN";
    options.ClientBasicAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" };
    options.Environment = ServerEnvironment.Production;
    // TODO: configure more client options here
});

Direct Instantiation

Create the client by passing an HttpClient you manage yourself. Configure the client's behavior through InCountryRestApiClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new InCountryRestApiClientOptions
{
    BearerAuth = "YOUR_BEARER_TOKEN",
    ClientBasicAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" },
    Environment = ServerEnvironment.Production,
};
var client = new InCountryRestApiClient(httpClient, options);

On this page