Amcrest PT(z) Preset Command Line

Joined
Dec 28, 2022
Messages
23
Reaction score
14
Location
Midwest
I have an Amcrest IP5M-1190 with a few presets defined. I can send the following using Brave browser and the camera goes to the requested preset:
Code:
http://admin:password@192.168.1.180/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=5&arg3=0
I'd like to setup a script to transition through various presets eventually on a schedule. I've tried several ways to do this in PowerShell and cmd shell with Invoke-WebRequest/credentials, ssh, curl, etc. but nothing works.

Even a simple request fails:
Code:
Invoke-WebRequest "http://192.168.1.180/cgi-bin/devAudioInput.cgi?action=getCollect" -Credential $cred
Invoke-WebRequest : Error Bad Request!
At line:1 char:1
+ Invoke-WebRequest "http://192.168.1.180/cgi-bin/devAudioInput.cgi?act ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Any tips on how to make a simple command line request work with Amcrest?


FWIW, the Invoke-WebRequest method works with my IPC-Color4K-T:
Code:
Invoke-WebRequest "http://192.168.1.108/cgi-bin/devAudioInput.cgi?action=getCollect" -Credential $cred
 

jack7

Pulling my weight
Joined
Mar 21, 2019
Messages
323
Reaction score
250
Location
USA
If not using it, try using curl digest authentication for http. The camera requires digest. I don't use curl, but here's a possible example.

curl --digest --user daniel:secret
And your URL
 
Joined
Dec 28, 2022
Messages
23
Reaction score
14
Location
Midwest
Awesome - that worked perfectly.

Thanks!

Just to close out with the original command in the correct format using curl & cmd-shell:
Code:
curl --digest --user admin:password "http://192.168.1.180/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=2&arg3=0"
This commands the camera to preset position 2 (value of arg2)
 
Top