Jenkins API resulting in HTTP ERROR 404

681 views
Skip to first unread message

Jenkins User

unread,
Mar 28, 2018, 5:55:55 PM3/28/18
to Jenkins Users
Hi All,

I'm using Jenkins 2.89.4.

I'm making an API call using 

/usr/bin/curl -X GET -k --cookie `cat cookie.txt` https://JENKINS_URL/job/MYJOBNAME/lastCompletedBuild/api/xml/ --user usr:token


But it is resulting in 404 error like below


<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

<title>Error 404 Not Found</title>

</head>

<body><h2>HTTP ERROR 404</h2>

<p>Problem accessing /jenkins/job/Hadoop-y-branch-2.8-3-EndToEnd/lastCompletedBuild/api/xml/. Reason:

<pre>    Not Found</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>


</body>

</html>


I also enabled 'Prevent Cross Site Request Forgery exploits' and 'Enable proxy compatibility' in configureSecurity but could not get it to work. Am I missing something obvious?


$ curl --version

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 

Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 


Any help will be appreciated!


Thanks!

Jenkins User

unread,
Mar 28, 2018, 9:21:08 PM3/28/18
to Jenkins Users
FYI, this issue was due to restricted permission for the user. After relaxing the permission API call worked as expected.

Thanks!
Reply all
Reply to author
Forward
0 new messages