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 whether you accept or reject these cookies being set.

Fibaro HC3 to homeLYnk
#1
I try to past some data from the Fibaro HC3 gateway (also LUA) to a homeLYnk (2.5.1) but received an error 401.

The same credentials and url works in my browser or from HL to HL. 

Anyone a idea why the HL doesn't accept data in that way?

Code:
function testHttp(self)
    local address = "http://XXX:XXX@XX.XX.XX.XX/scada-remote/request.cgi?m=json&r=grp&fn=write&alias='32/1/1'&value=true"
    self.http = net.HTTPClient({timeout=3000})
    self.http:request(address, {
        options={
            headers = {
                Accept = "application/json"
            },
            checkCertificate = false,
            method = 'GET'
        },
        success = function(response)
            self:debug("response status:", response.status)
            self:debug("headers:", response.headers["Content-Type"])
            local data = json.decode(response.data)
        end,
        error = function(error)
            self:debug('error: ' .. json.encode(error))
        end
    })
end

function QuickApp:onInit()
    self:debug("onInit")
    testHttp(self)
end
Reply
#2
Don't use single quotes in alias parameter. Also try replacing each / in alias with %2F
Reply
#3
(15.09.2020, 14:54)admin Wrote: Don't use single quotes in alias parameter. Also try replacing each / in alias with %2F

solved, using a basic authorization header
Reply


Forum Jump: