Mimicking curl digest command

I am trying to set up a virtual device as a switch to trigger a call to my camera software. A sample call looks like:

curl -v --digest -u 'admin:1234' 'http://172.16.0.189/cgi-bin/split.cgi?action=setMode&channel=0&mode=split1&group=0'

I tried to replicate it with the HTTP momentary switch but it fails as it doesn't have the authentication piece.

Is there another way to accomplish this?

I used to trigger snapshots from my cameras managed by iSpy on a windows machine using a rule machine rule. It was an http string very similar to what you are using.

You already know, that you can use http://[username]:[password]@[url] to transfer username and password to an http auth secured server, don't you?

Not for digest authentication.

Scratch that. Might just work. Hold please

This configuration doesn't seem to work

Where is the code that you're using for that screenshot? Adding the Authentication header should not be too difficult, but seeing the code would make it easier to offer suggested improvements.

I'm using the HTTP Momentary Switch

That link does not contain any code, and I don't think you're talking about a built-in driver. Where did you get the code that you are using?

My bad -- not sure why that link popped up. Here's the code.

Cool, thanks for sharing.

I was going to start trying to put together an example, but @VeloWulf already has a great start here: Coding an HTTPS request with authentication - #19 by VeloWulf

You could use a structure similar to @VeloWulf's pollASNServer() from hubitat-myenergi-app.groovy in place of runCmd() in the code you are using now.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.