vMix Forums
»
General
»
3rd Party Software and Development
»
Script to trigger an API command with user and password
Rank: Newbie
Groups: Registered
Joined: 11/17/2020(UTC) Posts: 5 Location: Villach Thanks: 4 times
|
Hi all, i use this script to control the PTZ API of my AXIS Cameras. e.g.: http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2The Script looks like this (thanks kgoodyer): Quote: Dim webStream As Stream Dim webResponse = "" Dim req As HttpWebRequest Dim res As HttpWebResponse req = CType(WebRequest.Create("http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2"), HttpWebRequest) res = CType(req.GetResponse(), HttpWebResponse) webStream = res.GetResponseStream() ' Get Response Dim webStreamReader As New StreamReader(webStream) While webStreamReader.Peek >= 0 webResponse = webStreamReader.ReadToEnd() End While
The Problem is, i don't know how to do a request with a password, Quote:http://USER:PASSWORT@192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2 does not work. So is there a possibility to send user and password with a HttpWebRequest? Best, Thomas
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/31/2020(UTC) Posts: 144 Thanks: 2 times Was thanked: 28 time(s) in 28 post(s)
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/17/2020(UTC) Posts: 5 Location: Villach Thanks: 4 times
|
Thank you for the answer, but unfortunately i am not able to translate the c# example to VB.Net.
Maybe anyone can do?
Thanks, Tom
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/31/2020(UTC) Posts: 144 Thanks: 2 times Was thanked: 28 time(s) in 28 post(s)
|
I'm a C++ and C# software engineer, but I don't work with VB.Net. So here's a stab by me, completely untested, I don't even know if it would compile. Quote: Dim webStream As Stream Dim webResponse = "" Dim req As HttpWebRequest Dim res As HttpWebResponse
Dim uri as New Uri("http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2") Dim username as String = "PutYourUsernameHere" Dim password as String = "PutYourPasswordHere"
req = CType(WebRequest.Create(uri), HttpWebRequest)
Dim myNetworkCredential As New NetworkCredential(username, password)
Dim myCredentialCache As New CredentialCache myCredentialCache.Add(uri, "Digest", myNetworkCredential)
req.PreAuthenticate = true req.Credentials = myCredentialCache
res = CType(req.GetResponse(), HttpWebResponse) webStream = res.GetResponseStream() ' Get Response Dim webStreamReader As New StreamReader(webStream) While webStreamReader.Peek >= 0 webResponse = webStreamReader.ReadToEnd() End While
If there are syntax or compile errors, someone who actually knows VB.Net will have to take a look at it. Hope this helps! -- Kevin
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/17/2020(UTC) Posts: 5 Location: Villach Thanks: 4 times
|
I still couldn't get it working.
Anyone else who knows how to get this done in VB.Net?
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/6/2021(UTC) Posts: 1 Location: New York
|
Jenkins provides machine-consumable remote access API to its functionalities. Currently trigger a new build In order to make this command work, you need to configure your Jenkins job to take a file in environments where XML manipulation is tedious (such as shell script.) Username/password based authentication. mygiftcardsite
|
|
|
|
vMix Forums
»
General
»
3rd Party Software and Development
»
Script to trigger an API command with user and password
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close