Skyline.DataMiner.Utils.UserDefinedApiToolkit
10.4.1.1
Prefix Reserved
dotnet add package Skyline.DataMiner.Utils.UserDefinedApiToolkit --version 10.4.1.1
NuGet\Install-Package Skyline.DataMiner.Utils.UserDefinedApiToolkit -Version 10.4.1.1
<PackageReference Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" Version="10.4.1.1" />
<PackageVersion Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" Version="10.4.1.1" />
<PackageReference Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" />
paket add Skyline.DataMiner.Utils.UserDefinedApiToolkit --version 10.4.1.1
#r "nuget: Skyline.DataMiner.Utils.UserDefinedApiToolkit, 10.4.1.1"
#:package Skyline.DataMiner.Utils.UserDefinedApiToolkit@10.4.1.1
#addin nuget:?package=Skyline.DataMiner.Utils.UserDefinedApiToolkit&version=10.4.1.1
#tool nuget:?package=Skyline.DataMiner.Utils.UserDefinedApiToolkit&version=10.4.1.1
Skyline.DataMiner.Utils.UserDefinedApiToolkit
About
Quickly build REST APIs in DataMiner using an attribute/controller-based approach similar to ASP.NET Core. This package builds upon the User-Defined API actions available in DataMiner and makes them easier to use, providing attribute routing, dependency injection, typed results, and automatic OpenAPI specification generation.
using Microsoft.Extensions.DependencyInjection;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net.Apps.UserDefinableApis.Actions;
using Skyline.DataMiner.Utils.UserDefinedApiToolkit;
/// <summary>
/// DataMiner Script Class.
/// </summary>
public static class Script
{
private static IUserDefinedApi _api;
/// <summary>
/// The Script entry point.
/// </summary>
/// <param name="engine">Link with SLScripting process.</param>
/// <param name="requestData">The incoming API request.</param>
[AutomationEntryPoint(AutomationEntryPointType.Types.OnApiTrigger)]
public static ApiTriggerOutput OnApiTrigger(IEngine engine, ApiTriggerInput requestData)
{
// Build the API once and cache it; AddControllers() scans the calling assembly and
// registers every public ControllerBase implementation decorated with [Route].
if (_api is null)
{
_api = UserDefinedApi.CreateBuilder()
.AddControllers()
.ConfigureServices(services => services.AddScoped<IUserRepository, UserRepository>())
.Build();
}
return _api.Run(engine, requestData);
}
}
// You can define your endpoints by inheriting from the ControllerBase class
[ApiController]
[Route("v1/users")]
public class UsersController : ControllerBase
{
private readonly IUserRepository _repository;
public UsersController(IUserRepository repository)
{
_repository = repository;
}
[HttpGet]
[Produces("application/json")]
public ApiResult<UserDto, string> GetById([FromQuery] int id)
{
var user = _repository.GetById(id);
return user is null ? NotFound("User not found.") : Ok(user);
}
[HttpPost]
[Consumes("application/json")]
public ApiResult<UserDto, string> Create([FromBody] UserDto dto)
{
_repository.Create(dto);
return Created(dto);
}
}
If you have questions, you can post them to our DataMiner community platform.
Installation
dotnet add package Skyline.DataMiner.Utils.UserDefinedApiToolkit
Features
| Feature | Description |
|---|---|
| Attribute routing | [ApiController], [Route], [HttpGet]/[HttpPost]/[HttpPut]/[HttpDelete] |
| Parameter binding | [FromQuery] and [FromBody] |
| Typed results | ApiResult<TSuccess> / ApiResult<TSuccess, TError> plus helpers such as Ok, NotFound, BadRequest, Created, Conflict, StatusCode, ... |
| Dependency injection | Built-in DI container via ConfigureServices and constructor injection in controllers |
| OpenAPI generation | Generates an OpenAPI 3.0 spec from your controllers at build time |
Generating an OpenAPI specification
Add the following to your API project's .csproj to generate an openapi.yaml (or .json) file in your build output whenever you build:
<PropertyGroup>
<GenerateOpenApi>True</GenerateOpenApi>
<OpenApiFormat>yaml</OpenApiFormat>
</PropertyGroup>
The generated document includes every controller's routes, HTTP methods, request/response schemas, and (when GenerateDocumentationFile is enabled) the XML doc comments on your actions.
Access API Context
Access the underlying API request and response through the ApiContext property:
public class MyController : ControllerBase
{
public IApiResult MyAction()
{
var request = this.Request; // ApiTriggerInput
var response = this.Response; // ApiTriggerOutput
// ...
}
}
About DataMiner
DataMiner is a transformational platform that provides vendor-independent control and monitoring of devices and services. Out of the box and by design, it addresses key challenges such as security, complexity, multi-cloud, and much more. It has a pronounced open architecture and powerful capabilities enabling users to evolve easily and continuously.
The foundation of DataMiner is its powerful and versatile data acquisition and control layer. With DataMiner, there are no restrictions to what data users can access. Data sources may reside on premises, in the cloud, or in a hybrid setup.
A unique catalog of 7000+ connectors already exists. In addition, you can leverage DataMiner Development Packages to build your own connectors (also known as "protocols" or "drivers").
Note See also: About DataMiner.
About Skyline Communications
At Skyline Communications, we deal in world-class solutions that are deployed by leading companies around the globe. Check out our proven track record and see how we make our customers' lives easier by empowering them to take their operations to the next level.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.4)
- Skyline.DataMiner.CICD.CSharpAnalysis.Analyzer (>= 2.1.2)
- Skyline.DataMiner.Dev.Automation (>= 10.4.1.3)
- Skyline.DataMiner.Utils.SecureCoding.Analyzers (>= 2.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.4.1.1 | 86 | 7/6/2026 |