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.

AXIS D2050-VE Radar control
#1
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:
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)
I need this to work with digest.

Thanks!
Reply
#2
Try digest code from this post:

https://forum.logicmachine.net/showthrea...64#pid9364

BR,

Erwin
Reply
#3
(09.05.2020, 09:22)Erwin van der Zwart Wrote: Try digest code from this post:

https://forum.logicmachine.net/showthrea...64#pid9364

BR,

Erwin
Thank You, I tried this, but cannot manage on how to change method to POST and add json body to it Sad
If i change method it tells me i'm giving wrong credentials.
Reply


Forum Jump: