Adding contextual data with the REST API
Contextual data plays a vital role in enhancing the intelligence and functionality of IoT devices. This section explains how to add contextual data to BMC Helix Edge devices. You can access insights in BMC Helix Dashboards and allow the development of rules and Machine Learning models.
You must build an Application Programming Interface (API) by using Swagger to add contextual data. Swagger is an OpenAI suite for API developers.
What is contextual data?
Contextual data refers to additional information that provides a broader understanding of the circumstances or environment in which something exists. In BMC Helix Edge, contextual data enhances the interpretation of metrics, events, or actions by providing relevant details about the surroundings, conditions, or configurations.
With contextual data, you analyze the information devices generate for better decision-making and insights into the overall operational context.
The examples of contextual data in the context of BMC Helix Edge might include:
Location information |
|
Environmental conditions |
|
Device metadata |
|
Operational context |
|
Time-related data |
|
Usage patterns |
|
Security and access information |
|
Use the following steps to integrate and ingest contextual data for BMC Helix Edge to provide this data for device management, rule creation, and machine learning model development.
Preparing an API request
Before ingesting contextual data, prepare an API request by using the Curl tool or other programming languages capable of making HTTP requests.
Here is an example by using the curl tool:
curl --location --request POST 'http:// <<HelixEdgeServerCore>>-vpn3l3:8000/hedge/api/v2/metadata/device/biz/AltaNS12' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data '{
"last_refilled_qty_liters": 92,
"last_refilled_date": 1691047381,
"last_refilled_cost_inr": 90000
}'
- Replace the URL in the API request with the appropriate BMC Helix Edge installation endpoint.
- Make sure that the Authorization header is set based on your system's integration with BMC Helix Single Sign-On (Remote Server Sign-On).
- Make sure that the authorization method is configured accordingly.
Include the contextual data specific to your use case in the API request payload (the data part). In the example above, we included data related to a vehicle's fuel refill:
- last_refilled_qty_liters represents the quantity of fuel in liters from the last refill.
- last_refilled_date indicates the time stamp of the last refill.
- last_refilled_cost_inr specifies the cost of the last refill in Indian Rupees (INR).
Sending the API request
Run the curl command or make the corresponding API call by using your chosen programming language. This request sends the contextual data to BMC Helix Edge for ingestion.
GET /contextual data