使用JIRA时,Rest API 401出错

时间:2014-01-17 19:24:45

标签: api rest jira unauthorized

我尝试使用REST API获取一些信息,它似乎在VBA(在Excel中)完全正常

但是当我在Java上尝试同样的事情时,我得到一个401错误:

java.io.IOException: Server returned HTTP response code: 401 for URL: https://y.y.y/jira/rest/api/latest/issue/PROJ-123
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at com.jpmchase.jiraextraction.apiHandler.getHTML(apiHandler.java:61)
at com.jpmchase.jiraextraction.apiHandler.main(apiHandler.java:19)

同样当我在python 2.7中尝试这个时

File "C:\Python27\lib\urllib2.py", line 127, in urlopen
 return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 410, in open
 response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 523, in http_response
 'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 448, in error
 return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
 result = func(*args)
File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized

知道为什么吗?

0 个答案:

没有答案