Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stash REST API: how to get a list of Pull Request including those has been merged or declined

youxing98 February 21, 2013

I am try to get a list of all pull-request, but it never request those that have been merged or declined.

I am using /projects/{projectKey}/repos/{repositorySlug}/pull-requests

am I using the wrong request? Thanks a lot!

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2013

Hi Simon,

It appears our REST documentation is a bit misleading for that resource. You'll need to supply an additional query parameter to retrieve pull requests in a non-open state.

GET /projects/{projectKey}/repos/{repositorySlug}/pull-requests?state=DECLINED

Will return declined pull requests.

GET /projects/{projectKey}/repos/{repositorySlug}/pull-requests?state=MERGED

Will return merged pull requests.

I've raised https://jira.atlassian.com/browse/STASH-3162 to fix the documentation. Thanks for pointing this out!

cheers,

Tim

0 votes
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2013

Hi again Simon,

To answer your second question:

> For those pull-ruquest which are open, how do I get the list of "APPROVED","UNAPPROVED" activities?

The following REST API will return you a list of all activities for a particular pull request:

GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities

There is currently no way to limit the response to just approved/unapproved items, so comments and other activity items will be in the response as well. If this limiting activity to a certain type is important to you, I'd recommend raising an issue in the Stash project at https://jira.atlassian.com.

If you're curious, the full Stash REST API documentation is available here: https://developer.atlassian.com/stash/docs/latest/reference/rest-api.html

cheers,

Tim

0 votes
AjayA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2013

Follow-up question from customer:

I still need something else, wonder if you help me again:

For those pull-ruquest which are open, how do I get the list of "APPROVED","UNAPPROVED" activities?

0 votes
youxing98 February 24, 2013

Thank a lot!

I still need something else, wonder if you help me again:

For those pull-ruquest which are open, how do I get the list of "APPROVED", "UNAPPROVED" activities?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events