Hallo zusammen,
für meinen Flüssiggastank bekomme ich per Restful (curl) Abfrage Daten geliefert. Den Inhalt, im speziellen nur 2 Werte benötige ich um den Inhalt des Gastanks auszuwerten. Wer kann mir dabei helfen. Ich habe einen Abfragecode und bekomme ein Ergebnis als Json. Was mache ich mit dem Abfrage (GET) code und wie werte ich das Ergebnis aus. Ich bin in dem Thema absoluter Laie.
Abfragecode:
curl --request GET \
--url 'https://webapp.r-c-t.biz/api/v1/tankObjects?page=1&include=device' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'
Ergebnis:
HTTP/2 200
server: nginx
date: Tue, 01 Oct 2024 13:20:15 GMT
content-type: application/json
x-powered-by: PHP/8.2.24
cache-control: private, must-revalidate
pragma: no-cache
expires: -1
access-control-allow-origin: *
vary: Authorization
x-powered-by: PleskLin
{"data":[{"id":4699,"active":true,"name":"Gastank","volume":2700,"type":"Propane","unit":"L","code":"1","info":null,"critPercentage":20,"minPercentage":30,"maxPercentage":85,"privateInfo":null,"device":{"id":5499,"sid":"WIFI-901867-01","type":"WIFI","sensor":"Filling","configuration":null,"receivedLastTelemetry":"2024-10-01 09:16:25","battery":"50.00","signal":61,"temperature":"14.00","*value":891*,"rawValue":33,"lastRefill":"2000-01-01 00:00:00","sendFrequency":21600,"batteryStatus":"ok","signalStatus":"ok","sendingStatus":"ok","*percentage":"33.00*"}}],"links":{"first":"https:\/\/webapp.r-c-t.biz\/api\/v1\/tankObjects?page=1","last":"https:\/\/webapp.r-c-t.biz\/api\/v1\/tankObjects?page=1","prev":null,"next":null},"meta":{"current_page":1,"from":1,"last_page":1,"links":[{"url":null,"label":"« Previous","active":false},{"url":"https:\/\/webapp.r-c-t.biz\/api\/v1\/tankObjects?page=1","label":"1","active":true},{"url":null,"label":"Next »","active":false}],"path":"https:\/\/webapp.r-c-t.biz\/api\/v1\/tankObjects","per_page":20,"to":1,"total":1}}
Wäre super wenn mir jemand helfen könnte.
Viele Grüße Marco
by HarryP: Code-/Logzeilen formatiert (bitte immer in </> einbinden)