trying to open a new pull request from the REST API, according to https://developer.atlassian.com/static/rest/stash/3.11.6/stash-rest.html#idp3191968
Using this:
curl -i -X POST -u $USERNAME:$PASSWORD -H "Content-Type: application/json" http://bitbucket-server.on.my.net/rest/api/latest/projects/\~MY-USER/repos/MY-REPO/pullrequests --data '{"title": "title", "description": "let us fix it", "state": "OPEN", "open": true, "closed": false, "fromRef": { "id": "refs/heads/branch-with-commits", "repository": { "slug": "MY-REPO", "name": null, "project": { "key": "~USERNAME" } } }, "toRef": { "id": "refs/heads/master", "repository": { "slug": "MY-REPO", "name": null, "project": { "key": "~USERNAME" } } }, "locked": false, "reviewers": [] }'
I get:
HTTP/1.1 404
X-AREQUESTID: @1YZE055x940x74072x0
X-ASEN: SEN-9670286
X-AUSERID: 52
X-AUSERNAME: USERNAME
Cache-Control: no-transform
X-Content-Type-Options: nosniff
Vary: Accept
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Tue, 21 Nov 2017 15:40:27 GMT
Via: 1.1 google<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://bitbucket-server.on.my.net/rest/api/latest/projects/~USERNAME/repos/MY-REPO/pullrequests</message></status>
eventually, this worked (docs need fixin'):
curl -i -X POST -u $USERNAME:$PASSWORD \
-H "Content-Type: application/json" \
http://HOST/rest/api/latest/projects/\~USERNAME/repos/[lower-case-repo-name]/pull-requests \
--data '{"fromRef":{"id":"branch-with-commits","repository":{"slug":"lower-case-repo-name","name":"MY-REPO","project":{"key":"~USERNAME"}}},"state":"OPEN","title":"fix some issues","description": "let us fix it","toRef":{"id":"master","repository":{"slug":"lower-case-repo-name","name":"MY-REPO","project":{"key":"~USERNAME"}}}}'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.