Ditto as
IoT
and/or
Digital Twin
"middleware"
{
"thingId": "io.beyonnex.srt:my-srt",
"policyId": "io.beyonnex.room:my-room",
"attributes": {
"serial": "4711-0815",
"location": {
"buildingId": "nice-building"
}
},
"features": {
"temp": {
"properties": {
"value": 23.42
}
}
}
}
JSON repr. of a Thing
GET/PUT/PATCH/DELETE /things/io.beyonnex.srt:my-srt
/things/io.beyonnex.srt:my-srt/thingId
/things/io.beyonnex.srt:my-srt/policyId
/things/io.beyonnex.srt:my-srt/attributes
/things/io.beyonnex.srt:my-srt/attributes/serial
/things/io.beyonnex.srt:my-srt/attributes/location
/things/io.beyonnex.srt:my-srt/attributes/location/buildingId
/things/io.beyonnex.srt:my-srt/features
/things/io.beyonnex.srt:my-srt/features/temp
/things/io.beyonnex.srt:my-srt/features/temp/properties
/things/io.beyonnex.srt:my-srt/features/temp/properties/value
HTTP API of the Thing
→ docs
Ditto provides persistence and APIs to manage Connections
connectivity takes care of
example of HTTP APIs
Benefits:
Benefits:
{{ thing:id }} # affected (e.g. modified) thing id
{{ feature:id }} # affected feature id
{{ header:[header-name] }} # internal or external header value, depending on which "direction" of mapping
{{ topic:full }} # the full Ditto Protocol topic, e.g.: io.beyonnex/srt-123/things/twin/events/merged
{{ topic:entityName }} # the entity name of the Ditto Protocol topic, e.g.: srt-123
{{ topic:action }} # the action of the Ditto Protocol topic, e.g.: merged
{{ thing-json:[json-pointer] }} # the content of the JSON field in the affected thing, identified by the JSON pointer
{{ time:now }} # the current timestamp in ISO-8601 format
now the fun starts - what if transforming headers need to be done? sure, provide a function library
{{ header:foo | fn:default('fallback') }} # provide a default value if placeholder not existing
{{ header:foo | fn:substring-before(':') }} # select parts of a string
{{ header:foo | fn:substring-after(':') }} # select parts of a string
{{ header:foo | fn:replace('foo','bar') }} # replace characters in a string
{{ header:foo | fn:lower() }} # lowercase
{{ header:foo | fn:upper() }} # uppercase
{{ header:foo | fn:trim() }} # trim from trailing/appended whitespaces
{{ header:foo | fn:split(',') }} # split string by delimiter
{{ header:foo | fn:join(';') }} # join array into a string
{{ header:foo | fn:url-encode() }} # URL encode string
functions can - obviously - be combined with pipes |