Defect #8883

Issues Rest API returns HTML instead of xml or json payload

Added by zlatko arifhodzic almost 9 years ago. Updated over 8 years ago.

Status:ClosedStart date:2011-07-22
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:REST API
Target version:-
Resolution:Invalid Affected version:1.2.1

Description

Hi,

Seems that the issues Rest API is somehow broken in 1.2.1 version.

Hitting the appropriate url on both xml or json entry points returns a HTML page instead of xml or json payload.

Note that the projects API does not have this behavior, as it returns the expected xml or json payload.

Also note that the issue does not seem related to the http front-end as it is reproducible on both rack and apache2/passenger setups.

Steps to reproduce

  • DO : make sure you have a project with some issues, and an API key for the a given user
  • DO : execute :
    curl -X GET http://<myserver>/redmine/issues.json?key=<key>
  • OBSERVE : the log indicates :
Processing IssuesController#index to xml (for ::1 at 2011-07-22 15:18:41) [GET]
  Parameters: {"format"=>"xml", "action"=>"index", "controller"=>"issues", "key"=>"xxxxxxxxxxxxx"}
Rendering issues/index
Completed in 201ms (View: 144, DB: 10) | 200 OK [http://localhost/redmine/issues.xml?key=xxxxxxxxxxxxx]
  • EXPECT : an xml payload is returned
  • OBSERVE : curl returns the "issues search" page part in HTML format :
   <div class="contextual">
   </div>
   <h2>Issues</h2>
   ....

Environment

  • Fresh Redmine 1.2.1 installation from downloaded tarball
  • Rails 2.3.11
  • Ruby 1.8.7
  • MySQL 5.1.49
  • Debian Squeeze

response-before-patched.out - Response to Issues.json listing with 1.2.1 (30.9 KB) zlatko arifhodzic, 2011-07-25 11:53

response-patched.out - Response to Issues.json listing with 1.2.1 + r6309 reported (30.9 KB) zlatko arifhodzic, 2011-07-25 11:53

Associated revisions

Revision 6309
Added by Jean-Philippe Lang almost 9 years ago

Respond with errors and appropriate content type on /issues API calls with invalid query params (#8883).

Revision 7024
Added by Toshi MARUYAMA almost 9 years ago

respond nothing in case of content type is not html with invalid query params (#8883, #6317).

Revision 7025
Added by Toshi MARUYAMA almost 9 years ago

add test to respond nothing in case of content type is html with invalid query params (#8883, #6317).

Revision 7026
Added by Toshi MARUYAMA almost 9 years ago

add test to respond nothing in case of content type is not html with invalid query params (#8883, #6317).

History

#1 Updated by zlatko arifhodzic almost 9 years ago

Sorry, in the Steps To Reproduce section there is an inconsistency with the logs.

It should stated :

curl -X GET http://<myserver>/redmine/issues.xml?key=<key>

Nerveless, I tested both xml and json modes and both provide html instead of the API response.

#2 Updated by Jean-Philippe Lang almost 9 years ago

Can you attach the full html response please?

#3 Updated by zlatko arifhodzic almost 9 years ago

Jean-Philippe Lang wrote:

Can you attach the full html response please?

Not before monday, but I'll post the full response as soon as I get my hands on it.

Also note that only the index/list returns the html rendering. Getting an issue by ID (http://server/redmine/issues/&lt;ID&gt;.json) or even adding/updating issues works fine.

#4 Updated by Jean-Philippe Lang almost 9 years ago

I think you're getting html because something goes wrong with your issue query.
See source:/trunk/app/controllers/issues_controller.rb@6210#L99

I have to fix this behaviour.

#5 Updated by zlatko arifhodzic almost 9 years ago

Hi, I've tried to patch the 1.2.1 according to the commit in trunk, but the issue persists.

I've attached the responses obtained with and without the patch, and they are both quite the same ( a couple of velues differ, but the result is a html div not json or xml ).

#6 Updated by Etienne Massip almost 9 years ago

Are you sure you don't have any plugins which may affect the normal behavior ?

#7 Updated by zlatko arifhodzic almost 9 years ago

Well I do have a number of plugins, however I'm unable to indicate whenever they can interfere with the Rest API.

Here is the list of installed plugins :

  • Redmine Charts v0.1.0
  • Redmine Extended Spent Time plugin v0.0.2
  • Redmine Issue Due Date v0.1.0
  • Redmine Issue History plugin v0.0.1
  • Redmine Show Descriptions plugin v0.0.4
  • Redmine Work Time plugin v0.1.2

Most of them provide additional features, I'm not sure whenever they change the default issue listing behavior using the API.

But I can deploy a new instance of Redmine 1.2.1 from SVN skip the plugins, and do some tests on a fresh install. I'll try to do it today, tomorrow morning in worst case.

#8 Updated by zlatko arifhodzic almost 9 years ago

You're right Etienne, seems that some of the installed plugins break the Rest API.

I tested a fresh install from SVN and the API issue listing seem to be working !

Now I'll try to go through the installation each of the plugins and try to determine the causing the error ...

#9 Updated by zlatko arifhodzic almost 9 years ago

  • Status changed from New to Resolved

And the winner is :

  • Redmine Show Descriptions plugin v0.0.4

Once removed I can use the API to list the issues !

My apologies for reporting the issue and not proceeding sequentially on install time.

#10 Updated by Etienne Massip almost 9 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

#11 Updated by Terence Mill over 8 years ago

Done a fix, Will be available soon on https://github.com/cforce/redmine_show_descriptions

zlatko arifhodzic wrote:

And the winner is :

  • Redmine Show Descriptions plugin v0.0.4

Once removed I can use the API to list the issues !

My apologies for reporting the issue and not proceeding sequentially on install time.

Also available in: Atom PDF