Calling REST API to connect JIRA from Java has issues

Dinakar Hasthi June 30, 2016

Hi,

Today i have created hasthi.atlassian.net . I tried REST API call from the browser and able to get the JSON response.   The URL tried in the browser : https://hasthi.atlassian.net/rest/api/2/issuetype

However in From Java Program i'm not able to connect to hasthi.atlassian.net. Tried InetAddress.getByName("hasthi.atlassian.net") . It throws java.net.UnknownHostException.

Could you please help to resolve this issue, so that i can proceed further to make rest call from java program.

Thanks,

Dinakar

 

 

3 answers

0 votes
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2016

That's normal for corporate IT policies - your DNS access is restricted.

This works from the browser, because the browser is configured to go though an HTTP proxy (which does the actual name resolution). To make this work in Java you need to configure the same HTTP proxy as in the browser. You can do this from command line or set it programmatically - see here. Another option is to set it directly on the HTTP client you are using to make the HTTP request - check its documentation.

 

0 votes
Dinakar Hasthi July 1, 2016

Yes, i'm behind proxy. Not sure why it is working from browser and not from Java program. 

Also when i ping hasthi.atlassian.net from command prompt. It says couldn't find host. 

0 votes
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2016

Are you behind an HTTP proxy?

Suggest an answer

Log in or Sign up to answer