I am using following stash REST api calls for pull request
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests---successful
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve----successful
REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/PULL-REQUESTS/{PULLREQUESTID}/MERGE?VERSION------{"errors":[{"context":null,"message":"You are attempting to modify a pull request based on out-of-date information.","exceptionName":"com.atlassian.stash.pull.PullRequestOutOfDateException",
version' attribute in the returned JSON structure is always '0'
I am manully able to merge the pullrequest .Am I missing something
Atlassian stash v3.11.2
Thanks for the support.
Community moderators have prevented the ability to post new answers.
Hi Fabio
When I create a pull request using following commands
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests I get a json output which has id and version . For every new pull request the id is incrementing by one but the ersion is always 0 . I am using the same version and id in following command to merge the pull request
REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/PULL-REQUESTS/{PULLREQUESTID}/MERGE?VERSION
Thanks
Hi Preeti,
as specified here https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html#idp109440 before merging (using POST) you should fetch the current version of the pull request.
Could you try?
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fabio Thanks for looking into it. I tried GET method /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge {"canMerge":true,"conflicted":false,"vetoes":[]} which is good I tried POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge It gives the same 409 conflict error as above. Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Preeti,
in my opinion, issue is related to parameter VERSION .
Did you tried to perform just :
as specified here https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html#idp109440 ?
Let me know,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.