Request URL
http://<localhost>:<Port Number>/api/v2/device/metrics
Example request URL
bash
curl -X POST http://localhost:54444/api/v2/device/metrics -d '{"key": "value"}' -H 'Content-Type: application/json'
In this example, replace {"key": "value"} it with your JSON payload or data you want to send in the request body. The -H 'Content-Type: application/json header specifies that the content being sent is in the JSON format. You must adjust the payload according to your API requirements. This way, you can make the POST call more generic and adaptable to different scenarios.
Request header
Content-Type: application/json
| | | | |
---|
| | The profile name is associated with the device. | | |
| | This parameter is auto-generated and a unique identifier of the device. | | |
| | The name or identifier of the device. Use this parameter for all APIs. This parameter is unique across all nodes. | | |
| | Indicates whether the data represents an event (true) or not (false). | | |
| | An array of metric objects, each containing the following fields: - name (string): The name of the metric.
- value (number): The value of the metric.
- origin (number): The microsecond time stamp when the metric data was recorded.
| | |
Example request body
Example request body
json
{
"profileName": "FuelPump",
"deviceId": "2",
"deviceName": "PStation_1040_FP_2",
"isEvent": false,
"metrics": [
{
"name": "fp_currentReading_litres",
"value": 9.878996,
"origin": 1692599969274000
},
{
"name": "fp_fuelling_rate_liters_per_min",
"value": 29.878996,
"origin": 1692599969273000
}
]
}
Here's an example of how you can use the `curl` command to send data to the API:
Example usage with cURL
shell
curl --location 'http://clm-aus-vpn3l3:54444/api/v2/device/metrics' \
--header 'Content-Type: application/json' \
--data '{
"profileName": "FuelPump",
"deviceId": "2",
"deviceName": "PStation_1040_FP_2",
"isEvent": false,
"metrics": [
{
"name": "fp_currentReading_litres",
"value": 9.878996,
"origin": 1692599969274000
},
{
"name": "fp_fuelling_rate_liters_per_min",
"value": 29.878996,
"origin": 1692599969273000
}
]
}
The API responds with an appropriate HTTP status code to indicate the success or failure of the request. A successful response has a status code of 200 OK.
Example usage with cURL
200 OK