08.05.2020, 23:23
Hello!
I have this axis product in one project.
These radars are great for perimeter protection as they help to reduce fake triggers from IP cameras.
Also, when linked with PTZ cameras - they control PTZ to accurately track intruders with zoomed-in vision.
Everything would be fine, but PTZ tracking service is running on windows machine and i would like to control from LM when this service is available.
I thought that disabling radar while not needed would be easier task than stopping service on windows machine.
I need to HTTP POST JSON data with digest auth, and don't know how to assemble this request.
I successfully did it with basic auth, but i need digest, as 'radar autotracking for PTZ' needs this level of authorization.
Could someone help me?
Basic auth code is here:
I need this to work with digest.
Thanks!
I have this axis product in one project.
These radars are great for perimeter protection as they help to reduce fake triggers from IP cameras.
Also, when linked with PTZ cameras - they control PTZ to accurately track intruders with zoomed-in vision.
Everything would be fine, but PTZ tracking service is running on windows machine and i would like to control from LM when this service is available.
I thought that disabling radar while not needed would be easier task than stopping service on windows machine.
I need to HTTP POST JSON data with digest auth, and don't know how to assemble this request.
I successfully did it with basic auth, but i need digest, as 'radar autotracking for PTZ' needs this level of authorization.
Could someone help me?
Basic auth code is here:
Code:
function post(url, body)
local ltn12 = require('ltn12')
local http = require('socket.http')
local sink = {}
local res, err = http.request({
url = url,
method = 'POST',
headers = {
['Authorization'] = 'Basic '..(mime.b64('<username>:<password>')),
['Content-Length'] = #body,
['Content-Type'] = 'application/json',
},
sink = ltn12.sink.table(sink),
source = ltn12.source.string(body),
})
if res then
return table.concat(sink)
else
return nil, err
end
end
require('json')
url = 'http://<IPADDRESS>/axis-cgi/radar/control.cgi'
body = json.encode({ apiVersion = '1.3',context = '<client context>',method = 'setEnabled',params = {enabled = false}})
--res, err = post(url, body)
--log(res, err)
Thanks!