Hi Team,
I try to develop some QuickApp on my HC3, but I have an problem with the http request :
When I call an API (here switchbot api), the external API respond me an 403 error...
The probleme isn't the API because the same request with an little php script works...
I have tried much methods but I get only the response code 403.
Recently, I have downloaded an quickapp on the marketplace. All review on it are good but for me, it's doesn't work.
When I see the console logs, I can see the 403 error code from this downloaded QuickApp too.
Do you have an idea for my problem ?
You can find my function code here :
function QuickApp:GetDeviceList()
self.http = net.HTTPClient({timeout=10*1000})
local apikey = self:getVariable("apikey");
self:debug(apikey); --For debug an my token is successfuly loaded
local address = "https://api.switch-bot.com/v1.0/devices"
--local address = "http://10.0.10.10:1880/debug"
self.http:request(address, {
options = {
headers = {
["Authorization"] = apikey,
["Content-Type"] = "application/json; charset=utf8",
["Accept"] = "application/json",
["User-agent"] = "Mozilla/5.0" --For try but no change
},
checkCertificate = false,
method = 'POST'
},
success = function(response)
self:debug(response.status); --return : 403
self:debug(response.data); --return: nothing
self:debug(response.headers);--return: array
self:debug(message); --return: nil
end,
});
end