Getting 404 Not Found on only some Java API commands.
Added by Jack Emmerichs about 11 years ago
Environment: Redmine version 2.3.3.stable Ruby version 1.8.7-p352 (2011-06-30) [i386-linux] Rails version 3.2.13 Environment production Database adapter Mysql2 Java API jar used redmine-java-api-1.21.jar
I have the Java API set up and sort of working. I can execute the sample usage file shown in the "Using the REST API with Java" page at
[[http://www.redmine.org/projects/redmine/wiki/Rest_api_with_java]]
and display all the Issue records in our test project, so my Java code using the Java API accessing our Redmine environment seems to be working. However, I found that the command:
myRedmineManager.getIssues(projectKey, null)
will work with any project key and with a RedmineManager created with any constructor I've tried, including ones with a bogus apiAccessKey value (documented as not being checked), so it doesn't feel like this command actually uses any credentials to access its data.
If I then try to execute the "Get issue by ID:" example at the bottom of the "Using the REST API with Java" page the API dumps the following to stderr:
com.taskadapter.redmineapi.NotFoundException: Server returned '404 not found'. response body:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>Redmine 404 error</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
margin:10px;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
</style>
<body>
<h1>Page not found</h1>
<p>The page you were trying to access doesn't exist or has been removed.</p>
<p><a href="javascript:history.back()">Back</a></p>
</body>
</html>
I'm not too surprised to see an HTML page back from a REST request but it's not very helpful as I don't see what it is I can't find (The Project? The Issue? permissions to do this query?).
I'm currently using the following values to access a specific Issue:- redmineHost: "http://192.168.0.999/projects/actual_project_name"
- apiAccessKey: The actual access key value (Admin account's displayed value for the current API access key).
- projectKey: The actual project key value (Project Identifier as shown in the Project-->Settings-->Information page Identifier field).
- issueID: The actual ID value (The ID value of an Issue retrieved using the getIssues() command).
I would certainly appreciate any suggestions on getting the
RedmineManager.getIssueById(issueID, INCLUDE.relations)
request working. After that I'll work on updating objects in the Project (which currently fails with the same Not Found HTML page).
Thanks.