Re: Retrieving List of Issues via Web API?

51 views
Skip to first unread message

Christian Hammond

unread,
Apr 11, 2013, 2:59:20 AM4/11/13
to reviewb...@googlegroups.com
Hi,

Right now, yes, you need to make lots of calls. Really, I think it makes sense for us to expose APIs to do that. They just don't exist today.

What you'd need to do today is to get a list of all reviews on a review request, then get all the comments per-review. You can use the ?expand= to expand links in some of these to reduce the number of lookups needed, but it's still a lot of calls. Not ideal.

You shouldn't need to get the lists of file attachments and screenshots, or the diffs. Your API requests would only need to access /api/review-requests/<id>/reviews/, then you'd need diff-comments/, screenshot-comments/, and file-attachment-comments/ off of those. Combine those with ?expand= to the queries (something like ?expand=diff_comments, I believe), and you should be able to reduce these a bit.

I would be happy to take a patch that puts this all behind a cleaner API to just let you get and filter the table, and I can help discuss the design for that. I won't be able to take it on right away (a lot on my plate at the moment), but I think it's useful to have, and it sounds like it'd help you a lot.

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org


On Sun, Apr 7, 2013 at 7:46 PM, David Tuma <david...@gmail.com> wrote:
I am the author of another open source application, and I am working to develop an integration between my application and Review Board.

In Review Board 1.7, a very helpful "Issue Summary" section is displayed to assist with Issue tracking.  I am trying to retrieve the contents of that table by interacting with the Review Board Web API.  Due to my constraints, I need to limit myself to the items in the REST API 2.0 which are available in Review Board 1.6.

Unfortunately, I've spent hours in the documentation and I'm still uncertain how I should proceed.  I've also scrutinized the source code for Review Board to see how it retrieves the data in that table; but that exercise didn't prove helpful since I am limited to the queries I can perform through the REST API.

At the moment, it seems that I might need to:
  1. Make a series of API calls to retrieve a list of objects associated with a Review Request
  2. Then, make dozens of other calls to retrieve the comments that are attached to each individual object
  3. Finally, sift through the comments to see which ones open an issue
Is there a simpler way?  (This process is likely to take a very long time, unless I execute a large number of REST API calls in parallel.)

Also, I'm still very confused about which objects I need to retrieve in step #1 above:
  • It seems that I could retrieve a list of screenshots and file attachments; then I would be able to get a merged list of all comments attached to each one. 
  • For diff comments, it seems that I might either need to (a) retrieve a list of diffs, retrieve a list of files for each diff, then retrieve the comments associated with each file diff; or (b) retrieve a list of reviews, then retrieve the list of diff comments for each review.  Is this correct?  Which approach might be more efficient?
  • Also, I am confused about whether I need to repeat all of these steps for Review Replies, Review Reply Diffs/Files, Review Reply File Attachments, and Review Reply Screenshots.
If anyone can help with a small amount of advice, I would appreciate it immensely.  Thank you!

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

David Tuma

unread,
Apr 11, 2013, 5:44:29 PM4/11/13
to reviewb...@googlegroups.com, chi...@chipx86.com
Thank you very much for your help.  This has helped me tremendously.

Actually, with judicious use of the expand parameter, it looks like I might be able to retrieve all of the data I need with a single call:

/api/review-requests/{review_request_id}/reviews/?expand=diff_comments,screenshot_comments,file_attachment_comments&max-results=9999

It can take a while to execute for a complex review; but it's still much faster than making numerous calls.

Thank you again,


David
Reply all
Reply to author
Forward
0 new messages