Reputation: 115
I want to access JIRA from our server. I am on a intranet network and am logged in to one of our servers. I want to get list of all issues from the url: https://ficcjira.xyz.com/browse/ABC
using a REST API call.
I don't know much curl but I'm doing something like this:
curl -D- -u username:password -x GET -H "Content-Type: application/json" http://ficcjira.xyz.com/browse/ABC
But no good.
How exactly to do it?
Result response for the above curl:
HTTP/1.1 302 Found
Location: https://ficcjira.xyz.com/browse/abc
Server: BigIP
Content-Length: 0
Cache-Control: proxy-revalidate
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Date: Fri, 10 Jun 2016 21:00:39 GMT
Upvotes: 2
Views: 613
Reputation: 7489
From the code you posted, I see some errors:
I suggest you first try this URL in your browser, and see if you get any results:
http://ficcjira.xyz.com/rest/api/2/search?jql=project=ABC
If you do, you can then try this curl call:
curl --globoff --insecure --silent -u username:password -X GET -H 'Content-Type: application/json' "http://ficcjira.xyz.com/rest/api/2/search?jql=project=ABC"
You might get some more insight from my blog here: http://javamemento.blogspot.no/2016/05/jira-confluence-3.html
Why have you tagged this with java if you are using curl?
If you are indeed calling this REST API with a GET call from Java, you should be using jersey or Spring's RestTemplate to make the call.
On my blog here, you can get a sample of how to do this with RestTemplate
http://javamemento.blogspot.no/2016/06/rest-api-calls-with-resttemplate.html
Edit :
If you can access via browser but not curl, maybe you have a proxy set up. Try using the proxy option for the curl call
--proxy <[protocol://][user:password@]proxyhost[:port]>
Of course I hope you are already using the -L option as others already suggested?
Upvotes: 2