Actions
Feature #5997
closedREST API should provide valid xml response with status for EVERY request
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
2010-07-30
Due date:
% Done:
0%
Estimated time:
Resolution:
Wont fix
Description
Redmine's REST API provides valid XML response only if all request parameters are valid and accepted.
So for this URL
http://demo.redmine.org/projects/ace/issues.xml?query_id=302&key=1ddd3b8a5f4484bc658727586681f15189b42ac7
a valid XML with list of issues will be returned,
but if I change query_id to some random value:
http://demo.redmine.org/projects/ace/issues.xml?query_id=6666&key=1ddd3b8a5f4484bc658727586681f15189b42ac7
- then response shown in Google chrome browser is:
Oops! This link appears to be broken.
and in Java program:
java.lang.RuntimeException: java.io.FileNotFoundException: http://demo.redmine.org/projects/ace/issues.xml?query_id=6666&key=1ddd3b8a5f4484bc658727586681f15189b42ac7 at org.alskor.mspsync.connector.redmine.RedmineRESTAPIConnector.loadData(RedmineRESTAPIConnector.java:77) at org.alskor.mspsync.ui.editors.ConnectorPanel$2.run(ConnectorPanel.java:128) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.io.FileNotFoundException: http://demo.redmine.org/projects/ace/issues.xml?query_id=6666&key=1ddd3b8a5f4484bc658727586681f15189b42ac7 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1311) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)I propose to change xml returned by Redmine REST API for ALL incoming requests to something like this:
<redmine_rest_api_response responseCode="0" responseDescription="..."> <issues>.......... </issues> </redmine_rest_api_response>
the new wrapping "redmine_rest_api_response" header node (or whatever you want to call it) should provide
- status code (0=OK, 1=authentication failure, 2=parameter invalid, 3=access key valid, but access denied to the specified resource - e.g. query ID belonging to other user, ...)
- response description - some human-readable text like "authentication failed: key 123 is not recognized" or "value '6666' or parameter 'query_id' is not allowed for the given API access key because..."
this would be really useful for building external applications on top of Redmine REST API.
Actions