C# SDK

Install and start using the C# SDK.

Intro

The Chemical Insights APIs - CI-API SDK provides access to the Chemical Insights APIs - CI-API REST APIs.

The CI API provides programmatic access to public chemical safety data from UL Research Institutes' Chemical Insights Research Institute: chemical identifiers and details, hazard, exposure and toxicokinetic data.

Installation

Add the SDK as a project reference into your solution:

Terminal
dotnet add reference <path-to-sdk>/src/ChemicalInsightsApIsCiApi/ChemicalInsightsApIsCiApi.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 ChemicalInsightsApIsCiApiClientOptions.

C#
services.AddChemicalInsightsApIsCiApiClient(options =>
{
    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 ChemicalInsightsApIsCiApiClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new ChemicalInsightsApIsCiApiClientOptions { Environment = ServerEnvironment.Production };
var client = new ChemicalInsightsApIsCiApiClient(httpClient, options);

On this page