Or a python script
I had to get some data with a header too, although it was only one item, the string returned after JSONPATH transform needed another transformation so I would have needed another item.
I use node-red for some functionality that can be difficult to achieve with OH but very easy with node-red
And the node-red code/json:
[
{
"id": "a9eebb8d.fba3d",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "ef747923.2a1e58",
"type": "http request",
"z": "a9eebb8d.fba3d",
"name": "",
"method": "GET",
"ret": "txt",
"url": "https://api.github.com/repos/arendst/Sonoff-Tasmota/tags",
"tls": "",
"x": 470,
"y": 180,
"wires": [
[
"a18dec1.b59151"
]
]
},
{
"id": "51d65b1.b6e1b24",
"type": "inject",
"z": "a9eebb8d.fba3d",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "86400",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 130,
"y": 180,
"wires": [
[
"77c832d0.ad9ffc"
]
]
},
{
"id": "a6a9456f.54c2d",
"type": "debug",
"z": "a9eebb8d.fba3d",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 910,
"y": 140,
"wires": []
},
{
"id": "77c832d0.ad9ffc",
"type": "function",
"z": "a9eebb8d.fba3d",
"name": "",
"func": "msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0';\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 310,
"y": 180,
"wires": [
[
"ef747923.2a1e58"
]
]
},
{
"id": "a18dec1.b59151",
"type": "json",
"z": "a9eebb8d.fba3d",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 610,
"y": 180,
"wires": [
[
"fc4afeeb.804d38"
]
]
},
{
"id": "fc4afeeb.804d38",
"type": "function",
"z": "a9eebb8d.fba3d",
"name": "",
"func": "msg.payload=msg.payload[0].name.substr(1);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 730,
"y": 180,
"wires": [
[
"a6a9456f.54c2d",
"8f1e7830.423998"
]
]
},
{
"id": "8f1e7830.423998",
"type": "openhab2-out",
"z": "a9eebb8d.fba3d",
"name": "",
"controller": "c022f913.0793f",
"itemname": "Sonoff_Current_FW_Available",
"topic": "ItemUpdate",
"payload": "",
"x": 950,
"y": 180,
"wires": [
[]
]
},
{
"id": "c022f913.0793f",
"type": "openhab2-controller",
"z": "",
"name": "Openhab",
"protocol": "http",
"host": "localhost",
"port": "8080",
"path": "",
"username": "",
"password": ""
}
]