Add API endpoint for getting all pull requests related to a user (BB-14638)

Issue #11575 resolved
Juned Miah
created an issue

Would it be possible to add an api call that allows the retrieval of all pull requests that concern a given user.


GET{owner}/{repo_slug}/pullrequests?state=[OPEN, MERGED, DECLINED]&user={concerninguser}&useris=[REVIEWER,AUTHOR]

Comments (7)

  1. Juned Miah reporter

    Yes, so I can use a single endpoint which will gives me back all pull requests where the given user is either an author of the pull request or a reviewer of the pull request.

    Perhaps maybe a participant could also be useful for people.

    Possible example could be:

    /repositories/{owner}/{repo_slug}/pullrequests?user={userid}&state=[OPEN, MERGED, DECLINED]

    or maybe we could have an extra query parameter which takes in 3 enums REVIEWER, AUTHOR, PARTICIPANT and if none if passed - all pull requests are returned where the user is either the reviewer or the author or a participant.

    The above example comes off /repositories/{owner}/{repo_slug}, it would be even better if we could go straight to /pullrequests so it searches more on a global scale, or maybe off /users/{username}/pullrequests. Obviously I am not sure which would be more performant, but if possible they would be even more helpful, but I am happy with the first example if it is at all possible to do.

    Thank you

  2. Zachary Davis

    You should be able to do something like:!api/2.0/repositories/{owner}/{slug}/pullrequests?q=(author.username="{username}" OR reviewers.username="{username}") AND state="OPEN"

  3. Log in to comment