This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

API Get help
#5
(29.01.2024, 10:58)admin Wrote: Post your full script and describe what exactly you want to achieve.

Code:
http = require('socket.http')
ltn12 = require('ltn12')

res, code = http.request({
url = 'https://horsensvej.rokum.ro/api/v1/entries?token=https%3A%2F%2Fhorsensvej.rokum.ro%2F%3Ftoken%3Dknx-2e4b5b25355f26bb',
method = 'GET',
})
log(res, code)
That is working, and the code you provided:
Code:
lines = data:split('\n')
for _, line in ipairs(lines) do
  items = line:split('\t')
  log(items)
end
But whatever I do I get a:
Code:
api 29.01.2024 12:55:29
Resident script:9: attempt to index global 'data' (a nil value)
stack traceback:

I want to put each segment into its own group address, Date, rawvalue, value, direction and CGM
Code:
"2023-11-27T21:26:49.676Z"    1701120409676    219    "SingleUp"    "xDrip-LimiTTer"
Reply


Messages In This Thread
API Get help - by Novodk - 27.11.2023, 21:45
RE: API Get help - by admin - 28.11.2023, 06:56
RE: API Get help - by Novodk - 29.01.2024, 10:53
RE: API Get help - by admin - 29.01.2024, 10:58
RE: API Get help - by Novodk - 29.01.2024, 12:17
RE: API Get help - by admin - 29.01.2024, 12:54
RE: API Get help - by Novodk - 29.01.2024, 13:37
RE: API Get help - by admin - 29.01.2024, 13:58

Forum Jump: