The Sample Scripted Connector scripted connector is a starter script designed to demonstrate how to push fixed data to DataMiner using the Data API. Unlike other connectors that fetch data from external sources, this script simply uses hardcoded data and sends it directly to DataMiner via HTTP PUT requests.
This connector is ideal for:
- Learning how to use the Data API for pushing data
- Testing DataMiner integrations without external dependencies
- Prototyping and development workflows
- Understanding authentication and HTTP request patterns
- Simple Data Push: Sends fixed data to DataMiner without requiring external data sources
- Bearer Token Authentication: Uses secure bearer token authentication with the Data API
- Error Handling: Includes exception handling for HTTP request failures
- Lightweight: Minimal dependencies with only Python's
requestslibrary required
- Python 3.x
requestslibrary (install viapip install requests)- Access to a DataMiner agent with the Data API enabled
- Valid bearer token for authentication
- User-defined API deployed and configured on DataMiner - This connector requires the user-defined API DataAPI Proxy to be deployed and configured on DataMiner. The API exposes the
/api/custom/data/parametersendpoint that this connector sends requests to.
Before running the script, update the following variables in dummy.py:
bearer = 'YOUR_BEARER_TOKEN_HERE'
host = 'system-organisation.on.dataminer.services'The script sends data to the DataMiner Data API with the following configuration:
| Parameter | Description | Example |
|---|---|---|
identifier |
The unique identifier for the data element | Equipment01 |
type |
The data type or category | PFU |
body |
The JSON data payload to push | {"Voltage": 0.1} |
Run the script from the command line:
python dummy.pyOn successful execution:
{'Authorization': 'Bearer YOUR_BEARER_TOKEN', 'Content-Type': 'application/json'}
PUT status: 200
If the HTTP request fails, the script will display an error message and exit:
HTTP request failed: [error details]
- Authentication Setup: Defines bearer token and host details for API access
- URL Construction: Builds the API endpoint with identifier and type parameters
- Request Headers: Sets up authorization and content-type headers
- Data Payload: Creates a JSON object with fixed data (e.g.,
{"Voltage": 0.1}) - HTTP PUT Request: Sends the data to the user-defined API endpoint on DataMiner
- Response Handling: Prints the HTTP status code and handles any exceptions
This scripted connector sends requests to a user-defined API endpoint exposed by DataMiner. The user-defined API that needs to be deployed and configured on your DataMiner instance before this connector can function.
Reference: Skyline DataMiner Catalog - Custom User-Defined API
The script targets:
https://{host}/api/custom/data/parameters?identifier={identifier}&type={type}
Method: PUT
Content-Type: application/json
Authentication: Bearer Token
This endpoint is exposed by the user-defined API and handles incoming PUT requests with custom data payloads.
To modify the data being pushed, edit the body variable:
body = { "Voltage": 0.1, "Current": 2.5, "Name": "Device 01" }To change the target identifier or type:
url_params = {
"identifier": 'DeviceIdentifier',
"type": 'DeviceType',
}