C# SDK

Install and start using the C# SDK.

Intro

The APIMatic Portal Artifacts API SDK provides access to the APIMatic Portal Artifacts API REST APIs.

Generate the artifacts an APIMatic API Portal needs (SDKs, code samples, getting started guides and, optionally, a context plugin) from a Portal Build Input, asynchronously.

The generation flow is:

  1. Upload your build directory as a zip file using Generate Portal Artifacts Async. You get back an id and links to check the status and download the artifacts.
  2. Poll Get Portal Artifacts Generation Status until generation completes, or pass the X-APIMatic-CallbackUrl header in step 1 to be notified instead.
  3. Download the generated artifacts using Download Generated Portal Artifacts.

Installation

Add the SDK as a project reference into your solution:

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

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 ApiMaticPortalArtifactsApiClientOptions.

C#
services.AddApiMaticPortalArtifactsApiClient(options =>
{
    options.Authorization = "YOUR_API_KEY";
    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 ApiMaticPortalArtifactsApiClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new ApiMaticPortalArtifactsApiClientOptions
{
    Authorization = "YOUR_API_KEY",
    Environment = ServerEnvironment.Production,
};
var client = new ApiMaticPortalArtifactsApiClient(httpClient, options);

On this page