NGSIv2 clients can customize HTTP notification messages using a simple template mechanism.
Considering the following notification notification.httpCustom
object:
"httpCustom": {
"url": "http://foo.com/entity/${id}",
"headers": {
"Content-Type": "text/plain"
},
"method": "PUT",
"qs": {
"type": "${type}"
},
"payload": "The temperature is ${temperature} degrees"
}
The token ${temperature}
will be parsed by current context value.
Thinking that attribute could have a metadata value could contain custom data like a temperature.scale
, to store values of '°C' or '°F' for example. How can I print it in that message?
Although attributes metadata there are 2 Special metadata in notifications:
previousValue
. The value of this metadata must be the previous value of the associated attribute. The type of this metadata must be the previous type of the associated attribute. If the type/value of previousValue is the same type/value than in the associated attribute, then the attribute has not actually changed its value.actionType
. It is included if the attribute to which it is attached was included in the request that triggered the notification. Its value depends on the request operation type: update for updates, append for the creation and delete for deletion. Its type is always Text.
The final result should be a message like that:
The temperature is now -10 °C degrees before was 9.1 °C degrees
Is it possible, who to use ?