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 Basic Auth
#1
Hello, I was wondering if anyone could help me with a script for API basic authentication (REST API).
I have only recieved a username, password and a specific URL for the request, which returns a table in JSON format.

I have tested the request in Postman and it works fine, I have looked at the Tesla API script and other examples but I am having trouble understanding how to do the request properly in LUA.

This is the response from the request in Postman:


Code:
[
  {
    "number": "205",
    "statuses": [
      {
        "status": "2",
        "changeDate": "2019-08-05"
      }
    ]
  },
  {
    "number": "515",
    "statuses": [
      {
        "status": "2",
        "changeDate": "2019-08-05"
      }
    ]
  }
]


I have to access "Number" (Room number) and "Status" (HVAC State) in the response and send it to an internal storage variable or something to compare it to the previous recieved value.
Reply


Messages In This Thread
API Basic Auth - by Krstfr2k - 05.08.2019, 09:03
RE: API Basic Auth - by admin - 05.08.2019, 09:53
RE: API Basic Auth - by Krstfr2k - 05.08.2019, 10:16
RE: API Basic Auth - by admin - 05.08.2019, 10:37
RE: API Basic Auth - by Krstfr2k - 05.08.2019, 11:10
RE: API Basic Auth - by admin - 05.08.2019, 11:15

Forum Jump: