Forum Discussion

amitt15's avatar
amitt15
Member
9 years ago

How can i get a reviewer state in script

Hi

I'm trying to monitor code reviews from automated script.

 

Is it possible to get the reviewer state (Approved or Active) using JSON API?

I can get the participants list of a given review, but it doesn’t show if a reviewer approve it already.

is there a different API I can use?

 

im using Collaborator version v9.2.9200

 

Thanks in Advanced

1 Reply

  • mschweers's avatar
    mschweers
    New Contributor

    Greetings,

    I fought this battle; the only way to get the reviewer state is via the 'review summary', which is actually ALL the information about the review.

     

    You get that by sending (replace 'review_id' with your own review number or variable):

     

        command: "ReviewService.getReviewSummary",

           args: { reviewId: review_id, clientBuild: 8200, active: true }

     

    I talk about this a little bit in another thread; it's awfully poorly documented, but it works.

     

    Under the result of that, you'll find a reviewParticipants array which contains the information you are looking for, specifically the assignmentState.  I mostly gate on whether or not the reviewer is in state /^FINISHED_/ because I can't find any enumeration of all the possible assignment states.

     

    I hope this helps!  It was really frustrating to get to this point, and the easier I can make it for anyone else, the better.

     

    --  Morgan

     

    p.s.  I've written a rudimentary Ruby library to help with this, but permission to release it is still going through my management chain. :-/