Hi,
My requirement is to attach a JIRA issue with pull request and one way I think is to specify the JIRA issue in the pull request title in stash. Can you please help me with the REST API to update the pull request's title with the JIRA issue?
Thanks
Thanks Mikael for quick response. I had tried with this REST API but facing below error:
The specified HTTP method is not allowed for the requested resource
This is the command I am using:
curl -X POST -u USERNAME:PASSWORD -H "Content-Type: application/json" -d '{"title":"PRT-7"}' https://HOSTNAME/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/29
Am I missing anything?
Thanks
You need to use PUT instead of POST, and you also need to include id, version, title, description and reviewers in your payload, not just the new title. Here is an example using Ruby:
def updatePullRequest(url, encode) put_request = { :id => 5, :version => 42, :title => "A change - updated via REST API", :description => "A description" } RestClient.put url, put_request.to_json, {:Accept => 'application/json', :Authorization => 'Basic ' + encode, :content_type => 'application/json', :data => put_request}
Note that the version has to be the same as the one you get in reply when doing a GET.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Mikael. It worked perfectly fine after adding version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check out /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}, the Put method allows you to modify the title, just send in the new title to replace the existing one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can I do this with merged pull requests (e.g. broken jira links)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.