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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" Version="10.4.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" Version="10.4.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Skyline.DataMiner.Utils.UserDefinedApiToolkit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Skyline.DataMiner.Utils.UserDefinedApiToolkit --version 10.4.1.1
                    
#r "nuget: Skyline.DataMiner.Utils.UserDefinedApiToolkit, 10.4.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Skyline.DataMiner.Utils.UserDefinedApiToolkit@10.4.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Skyline.DataMiner.Utils.UserDefinedApiToolkit&version=10.4.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Skyline.DataMiner.Utils.UserDefinedApiToolkit&version=10.4.1.1
                    
Install as a Cake Tool

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 Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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