Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3405 by rafal.wo...@gmail.com: The "Next" link in API response is wrong for non-standard queries for review requests
http://code.google.com/p/reviewboard/issues/detail?id=3405

*** READ THIS BEFORE POSTING!
***
*** You must complete this form in its entirety, or your bug report will be
rejected.
***
*** For customer support, please post to reviewbo...@googlegroups.com
***
*** If you have a patch, please submit it to
http://reviews.reviewboard.org/
***
*** Do not post confidential information in this bug report!


What version are you running?
1.7.22

What's the URL of the page containing the problem?
/api/review-requests/

What steps will reproduce the problem?
1. Produce large amount of review requests on RB and mark as submitted most of them
2. Ask REST API for those requests, for submitted only in example
3. Try to use the "NEXT" link and watch the result

What is the expected output? What do you see instead?
List of review requests returned by API was expected. I got "empty" answer.

What operating system are you using? What browser?
RB serwer is on Ubuntu 12.04. API tests were made with cURL.

Please provide any additional information below.

As I noticed, by default REST API returns only open review requests. So for query: wget -q -O - --header="Authorization: Basic $PassToken" --header="Accept: application/xml" "http://*/api/review-requests/?max-results=200";

I would get only - in example - 13 open requests. It may be considered as a bug, because documentation for the API ( http://www.reviewboard.org/docs/manual/1.7/webapi/2.0/resources/review-request-list/ ) says:

"By default, this returns all published or formerly published review requests."

But let's leave it for a while. Fixing it will not fix the following problem. If I send an API request:

wget -q -O - --header="Authorization: Basic $PassToken" --header="Accept: application/xml" "http://*/api/review-requests/?status=all&max-results=200";

and there are more than 200 results to return, I will get following NEXT link:

  <next>
   <href>http://*/api/review-requests/?start=200&amp;max-results=200</href>
   <method>GET</method>
  </next>

As the previously given parameter "status=all" is missing in the NEXT link, API will return bad answer.

Asking for requests with other ( i.e. submitted as below) status will produce the same problem: wget -q -O - --header="Authorization: Basic $PassToken" --header="Accept: application/xml" "http://*/api/review-requests/?status=submitted&max-results=20";

 <links>
  <self>
<href>http://*/api/review-requests/?status=submitted&amp;max-results=20</href>
   <method>GET</method>
  </self>
  <create>
   <href>http://sackreviewboard.emea.nsn-net.net/api/review-requests/</href>
   <method>POST</method>
  </create>
  <next>
   <href>http://*/api/review-requests/?start=20&amp;max-results=20</href>
   <method>GET</method>
  </next>
 </links>

The response for given NEXT link will be empty, because status=submitted is missing:

<rsp>
 <total_results>12</total_results>
 <stat>ok</stat>
 <review_requests>
  <array>
  </array>
 </review_requests>
 <links>
  <self>
   <href>http://*/api/review-requests/?start=20&amp;max-results=20</href>
   <method>GET</method>
  </self>
  <prev>
   <href>http://*/api/review-requests/?start=0&amp;max-results=20</href>
   <method>GET</method>
  </prev>
  <create>
   <href>http://*/api/review-requests/</href>
   <method>POST</method>
  </create>
 </links>


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To post to this group, send email to reviewboard-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.

Reply via email to