syphr42 / liblametrictime-java

Java binding client for the LaMetric Time local API
Apache License 2.0
1 stars 1 forks source link

Investigate and implement widget update endpoint #4

Closed syphr42 closed 7 years ago

syphr42 commented 7 years ago

"widget_update_url": "http://host:8080/api/v2/widget/update{/:id}"

syphr42 commented 7 years ago

It looks like this endpoint is used to push updates to an indicator app on the local network.

For example, if you had an weather indicator app with the ID "com.lametric.ef25a6c085ffc4a", you could send an update to it with the following to indicate the temperature went up one degree:

POST /api/v2/widget/update/com.lametric.ef25a6c085ffc4a HTTP/1.1
Host: host
Accept: application/json
Authorization: Basic ...
{
    "frames": [
        {
            "text": "1°",
            "icon": "i120"
        }
    ]
}
syphr42 commented 7 years ago

Fixed with 39c668ac1c2fe696b235441ae3c9adc445789228

reyem commented 7 years ago

Indicator apps are documented, when creating one via developer.lametric.com. After creating one the local endpoint is shown in the web interface. in my case for example:

https://192.168.1.202:4343/api/v1/dev/widget/update/com.lametric.488e77ba30798ff12674b2df930382ef/1

The last bit /1is the version and could be omitted to send updates to all versions of the app. I think the version is just relevant for cloud apps from the store where all devices with the app would be updates.

Probably you reverse engineered the v2 widget API which seems not to be documented yet :-), or this is "just" used for the native preinstalled apps.