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.

Ebeco floorheat thermostat
#5
(08.08.2022, 06:04)admin Wrote: Use this:
Code:
function GetToken()
  local response_body = {}
  local request_body = json.encode({
    userNameOrEmailAddress = userNameOrEmailAddress,
    password = password,
  })

  local body, code, hdrs, stat = ssl.https.request{
    url = 'https://ebecoconnect.com/api/TokenAuth/Authenticate',
    method = 'POST',
    headers = {
      ['Content-Type'] = 'application/json',
      ['Content-Length'] = #request_body,
      ['Abp.TenantId'] = 1,
    },
    source = ltn12.source.string(request_body),
    sink = ltn12.sink.table(response_body),
  }

  if code == 200 then
    ret = table.concat(response_body)
    ret = json.pdecode(ret)
    log(ret)
    return ret.access_token -- could be some other field, try to log ret to be sure
  else
    log('request failed', body, code, hdrs, stat)
  end
end

The request_url in RequestFromEbeco is wrong, it should be "https://ebecoconnect.com/api/services/app/Devices/GetUserDevices" (without any additional parameters).

Thanks, but did´nt get that to work either. But change my script line from having ". . ." to '. . .'
Then I put in log('request failed') and got this in response:
Ebeco REST API copy 08.08.2022 08:48:58
* arg: 1
  * string: request failed
* arg: 2
  * number: 1
* arg: 3
  * number: 415
* arg: 4
  * table:
  ["server"]
    * string: Microsoft-IIS/10.0
  ["connection"]
    * string: close
  ["content-length"]
    * string: 0
  ["x-rate-limit-limit"]
    * string: 60s
  ["x-rate-limit-remaining"]
    * string: 29
  ["request-context"]
    * string: appId=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  ["x-frame-options"]
    * string: SAMEORIGIN
  ["x-rate-limit-reset"]
    * string: 2022-08-08T06:49:58.5482160Z
  ["date"]
    * string: Mon, 08 Aug 2022 06:48:57 GMT
  ["x-xss-protection"]
    * string: 1; mode=block
  ["set-cookie"]
    * string: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxPath=/;HttpOnly;SameSite=None;Secure;Domain=ebecoconnect.com
  ["x-content-type-options"]
    * string: nosniff
* arg: 5
  * string: HTTP/1.1 415 Unsupported Media Type

I added the X:es if it might have been sensitive stuff Smile
Reply


Messages In This Thread
Ebeco floorheat thermostat - by victor.back - 17.12.2021, 06:50
RE: Ebeco floorheat thermostat - by admin - 17.12.2021, 07:42
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 06:04
RE: Ebeco floorheat thermostat - by victor.back - 08.08.2022, 06:56
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 07:06
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 07:24
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 08:01
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 09:27
RE: Ebeco floorheat thermostat - by admin - 08.08.2022, 12:07
RE: Ebeco floorheat thermostat - by admin - 31.10.2023, 07:57

Forum Jump: