I am invoking VB code to fetch JIRA cloud API and able to get positive results with GET request but POST request are creating issue. Proxy authentication error is coming.
Dim fr As System.Net.HttpWebRequest
Dim targetURI As New Uri(strURL)
Dim byteData() As Byte
Dim postStream As Stream
fr = DirectCast(HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)
Dim webProxy As IWebProxy = New WebProxy(strIpAddressAndPort)
webProxy.Credentials = New NetworkCredential(strProxyUsername, strProxyPassword)
fr.Proxy = webProxy
fr.Headers.Add(âAuthorizationâ, jwtOutput)
fr.Headers.Add(âzapiAccessKeyâ, âMWExM2QyZTYtYzBlMi0zODI5LWIzMjUtZWNjZDJjMâ)
fr.Method= âPOSTâ
byteData = System.Text.Encoding.UTF8.GetBytes(NewContent.ToString())
fr.ContentType = âapplication/jsonâ
fr.ContentLength = byteData.Length
MsgBox(byteData.Length)
postStream = fr.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
Dim res As HttpWebResponse = DirectCast(fr.GetResponse(), System.Net.HttpWebResponse)
webRes = res
Dim html As String = New StreamReader(res.GetResponseStream()).ReadToEnd()
strHtml = html
*RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> RemoteException wrapping System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required. *
* at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at UiPathCodeRunner_cbf3be3dabfa41f29ade6daba62745e1.Run(String strURL, String strIPAddressAndPort, String strProxyUsername, String strProxyPassword, HttpWebResponse& webRes, String& strHtml, String authenticationValue, String jwtOutput, String NewContent)*