An example of how to use the ClearInsights SDK within your ASPNetCore applications.
Explore the docs »
Report Bug
·
Request Feature
Install the ClearInsights SDK
- Package Manager
Install-Package ClearInsights -Version 1.0.42
- .Net CLI
dotnet add package ClearInsights --version 1.0.42
Create a free ClearInsights account to start using the SDK
-
Get a free account at https://clearinsights.io and retrieve your API Key under the Administration ->APIKey menu.
-
Create at least 1 product and 1 environment and retrieve the Client Secret for the product/environment.
-
Clone the repo
git clone https://github.com/ClearInsights/ClearInsights.Console.git
-
Enter your API Key and Client Secret in
Program.cs
builder.Logging.AddClearInsightsLogger(configuration => { configuration.ApiKey = "{ApiKey}"; configuration.Secret = "{Environment Client Secret}"; configuration.ApplicationName = "{Application Name}"; })
-
Use and extend global exception handling
//Add to use ClearInsights global error handling. //This will automatically catch any unhandled exceptions app.UseClearInsightsExceptionHandling(options => { //Add to extend the error handler and add additional logic. //Add logic like custom HTTP response, etc... options.OnError += (sender, arg) => { var response = "Oops something went wrong"; arg.HttpContext.Response.ContentType = "text/html"; arg.HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound; arg.HttpContext.Response.WriteAsync(response); }; });
Use this app as an example of how to use the ClearInsights SDK within your ASPNetCore applications.
For more examples, please refer to the Documentation