Form what I can see on your documentation, it's possible to query the database for additional data when writing CEL, but is it possible to call an external API? Is it also possible to update a Measurement to populate a missing value.
For example, if I want to update a measurement by adding the "alt" value of the "c8y_Position" segment by calling a specific API: https://maps.googleapis.com/maps/api/elevation/json?locations=40.714728,-73.998672
Is it possible write this kind of statement:
expression string js:getElevation(lng, lat) [
function request(lng, lat, callback) {
var xobj = new XMLHttpRequest();
// true parameter denotes asynchronous
xobj.open('GET', 'https://maps.googleapis.com/maps/api/elevation/json?locations=' + lat + ', ' + lng + ', true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
callback(xobj.responseText);
}
};
xobj.send(null);
}
request(lng, lat, function (data) {
return data.results.elevation;
});
]
insert into UpdateMeasurement
select
e.id as id,
getElevation(
getNumber(e, "c8y_Position.lng.value"),
getNumber(e, "c8y_Position.lat.value")
) as c8y_Position.alt
from MeasurementCreated e
Is it possible to make this kind of processing. Do you have more samples or documentation on CEL?