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:
- Upload your build directory as a zip file using Generate Portal Artifacts Async. You get back an
idand links to check the status and download the artifacts. - Poll Get Portal Artifacts Generation Status until generation completes, or pass the
X-APIMatic-CallbackUrlheader in step 1 to be notified instead. - Download the generated artifacts using Download Generated Portal Artifacts.
Installation
Add the SDK as a project reference into your solution:
dotnet add reference <path-to-sdk>/ApiMaticPortalArtifactsApi.csprojQuick 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.
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.
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);