Skip to content

SkylineCommunications/SLC-UDAPI-DataAPI-Proxy

Repository files navigation

User-Defined API DataAPI Proxy

About

This package contains a user-defined API that functions as a secure reverse proxy to enable external interaction with Data API.

The DataMiner Data API, which is currently still in soft-launch, offers flexible access to data from any source imaginable, across hardware, software, and cloud services. This data is directly reflected in the element, and can be easily updated using the same API, eliminating the need to develop a connector.

Currently, the Data API is limited to only accept local requests, most commonly through scripted connectors.

Setting up the proxy script

Deploying the user-defined API

Deploy the script onto your cloud-enabled DataMiner System.

See also: Managing APIs and tokens in DataMiner Cube

Configuring the user-defined API

  1. Configure the user-defined API to expose the Data API as an external API interface with the endpoints data/parameters and data/config.

  2. Set Method to be executed to "Raw body".

    Data API User Defined API Configure

  3. Secure the API with an API token.

    Data API User Defined API Overview

Using the Data API via the proxy

In this example, the endpoint /api/custom/data/parameters will be used with the HTTP verb PUT to send data to DataMiner and automatically create an element.

You can use any HTTP client to send data to the Data API via the proxy (e.g. Postman).

  1. Add URL-encoded parameters.

    When pushing data to DataMiner, you need to provide two URL parameters: identifier and type.

    • identifier: A unique identifier (e.g. DataAPI Test Element 1). This will be used as the name of the new element.
    • type: The type of the auto-generated connector (e.g. Skyline DataAPI Test Protocol).

    [!TIP] Each element requires a unique identifier, but elements can share a type. Elements that share a type will share the same parameters and layout, but can still have distinct data.

    [!IMPORTANT] When interacting with the Data API directly, identifier and type should be provided as HTTP headers, not as URL parameters.

  2. Configure JSON in the body.

    In this example, use the following JSON code:

    {
      "Server Name": "WebServer001",
      "CPU Utilization": 78.5
    }
  3. Configure the bearer token

    In your HTTP client, configure the bearer token. In Postman, this token is located on the Authorization tab.

    See also Configuring the user-defined API above.

  4. Send the request

    Send the PUT request. The result will indicate whether the operation was successful (200 OK) or not. In the latter case, feedback will be provided.

Result

After executing the PUT request, a new element should appear in your DataMiner System. Also, every update you send afterward will instantly be reflected in your new element.

The element will be associated with an automatically generated connector, which will be present in the Protocols and Templates module. There, you can configure alarm thresholds and trending to manage the received data.

Result

Prerequisites

  • DataMiner 10.4.2 or higher
  • A cloud-connected DataMiner Agent on which this user-defined API is deployed.

Documentation

For more information, see:

About

Forward data from external endpoints into the DataAPI via this User Defined API

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6

Languages