Timeseries Data
Produce
You can also publish three types of messages to the platform;
- Data Messages (Number, Boolean and String)
- Control Changes
- Recommendations
We'll go through those examples in the following sections.
Timeseries Data
In order to send data messages from Kelvin, you can connect to the Kelvin API to send the Asset / Data Stream pair data with the Timeseries endpoints.
curl -X 'POST' \
'https://<url.kelvin.ai>/api/v4/timeseries/create' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"data": [
{
"payload": 18000,
"resource": "krn:ad:bp_01/annulus_pressure",
"source": "krn:user:demo@kelvin.ai",
"timestamp": "2022-01-13T12:00:00.000000Z",
"type": "number"
}
]
}'
Control Changes
In order to send Control Changes from Kelvin, you can connect to the Kelvin API to send the Control Change instructions with the Create Control Change endpoint.
curl -X 'POST' \
'https://<url.kelvin.ai>/api/v4/control-changes/create' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"resource": "krn:ad:98-ac-1/humidity_setpoint",
"payload": 2001,
"timeout": 300,
"retries": 0,
"expiration_date": "2024-03-14T00:00:00Z"
}'
Recommendations
In order to send Recommendations from Kelvin, you can connect to the Kelvin API to send the Recommendation instructions with Control Change information using the Create Recommendation endpoint.
Warning
You will not be able to add evidence to Recommendations with this method. Only Kelvin SmartApps™ can utilize this feature.
To learn more about using evidences, follow this link here.
curl -X 'POST' \
'https://<url.kelvin.ai>/api/v4/recommendations/create' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"source": "krn:wlappv:cluster-02/perf-berp-rec-gen/1.0.8",
"resource": "krn:asset:perf-berp-perf-asset",
"actions": {
"control_changes": [
{
"resource": "krn:ad:perf-berp-perf-asset/perf-berp-perf-number",
"expiration_date": "2024-03-15T13:11:14.864627Z",
"payload": 14.5
}
]
},
"expiration_date": "2024-03-15T13:11:14.864661Z",
"metadata": {},
"resource_parameters": {
"closed_loop": false
},
"type": "perf-recommendation_type"
}'