3

I need to use jira Rest API to fetch some content in an excel sheet.The problem is that the server is siteminder enabled.I am using this codeproject article as reference (.http://www.codeproject.com/Articles/80314/How-to-Connect-to-a-SiteMinder-Protected-Resource ) but still cannot get to the past the siteminder login page For reference,my code is as follows:

Dim http As New WinHttp.WinHttpRequest
http.Option(WinHttpRequestOption_EnableRedirects) = False
url = "http://example.com"
' Launch the HTTP request
http.Open "GET", url, False
http.Send
target=http.GetResponseHeaders("location")//get the target url for post
Cookie=""
postData="USER="&HttpUtility.UrlEncode(username)&"&PASSWORD="&password
http.Open "POST", target, False
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.setRequestHeader "Cookie", Cookie
http.Send postData

The first http request takes me to the userlogin page of siteminder but the user doesn't get authenticated after the post request.I receive the error login page.Any suggestion as to how to get the user authenticated?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • The link you pointed to is a VB.NET article. So you'll need to use [MSXML2.ServerXMLHTTP](http://stackoverflow.com/q/158633/119477). Also you should post what you tried. – Conrad Frix Oct 30 '15 at 03:12
  • The code is as follows :Dim http As New WinHttp.WinHttpRequest http.Option(WinHttpRequestOption_EnableRedirects) = False url = "http://example.com" ' Launch the HTTP request http.Open "GET", url, False http.Send target=http.GetResponseHeaders("location")//get the target url for post Cookie="" postData="USER="&HttpUtility.UrlEncode(username)&"&PASSWORD="&password http.Open "POST", target, False http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" http.setRequestHeader "Cookie", Cookie http.Send postData – user1955851 Nov 02 '15 at 20:08
  • you should [edit] your question rather than adding an answer – Conrad Frix Nov 02 '15 at 20:20

0 Answers0