I'm trying to figure out what would be the syntax to create a pull request through the REST API. The description of the POST request is rather lacking, but, assuming one sends something similar to what GET retrieves, I'm still left with one problem: how do I specify the reference to a repository that is not on a project, but, rather, on a user?
As described under 'Personal Repositories' in the Stash REST API documentation:
Stash allows users to manage their own repositories, called personal repositories. These are repositories associated with the user and to which they always have REPO_ADMIN permission.
Accessing personal repositories via REST is achieved through the normal project-centric REST URLs using the user's slug prefixed by tilde as the project key. E.g. to list personal repositories for a user with slug "johnsmith" you would make a GET to:
http://example.com/rest/api/1.0/projects/~johnsmith/reposIn addition to this, Stash allows access to these repositories through an alternate set of user-centric REST URLs beginning with:
http://example.com/rest/api/1.0/users/~{userSlug}/reposE.g. to list the forks of the repository with slug "nodejs" in the personal project of user with slug "johnsmith" using the regular REST URL you would make a GET to:
http://example.com/rest/api/1.0/projects/~johnsmith/repos/nodejs/forksUsing the alternate URL, you would make a GET to:
http://example.com/rest/api/1.0/users/johnsmith/repos/nodejs/forks
Michael, so, we can only READ data using REST API? what about if i want to creat a new pull request using REST API?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@sergio - you can create pull requests using the rest api, please read the docs:
https://developer.atlassian.com/static/rest/stash/latest/stash-rest.html#idp2060848
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer @Seb Ruiz
i have readed this doc all day and also searched in google, but im not sure how to create the REST call of that API method.
reading the stash rest help (link you provided) i can see that call to is to get the pull requests of a branch, because in the params i cant see the necessary params to create a pull request:
[Source branch], [Destination branch], [Description], [reviewers]...etc.
can you maybe provide me a link or an example of a valid REST call to create the pull request with the params?
i really apreciate any help.
Thanks a lot again.
Sergio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
POST creates a pull request, GET retrieves the pull requests. You need to add a post body with details.
You can look at the stash command line tool which does this with Ruby.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
forget it, i found the way to call it, i was not seeying the request description in the top.
{ "title": "Talking Nerdy", "description": "It’s a kludge, but put the tuple from the database in the cache.", "state": "OPEN", "open": true, "closed": false, "fromRef": { "id": "refs/heads/feature-ABC-123", "repository": { "slug": "my-repo", "name": null, "project": { "key": "PRJ" } } }, "toRef": { "id": "refs/heads/master", "repository": { "slug": "my-repo", "name": null, "project": { "key": "PRJ" } } }, "reviewers": [ { "user": { "name": "charlie" } } ] }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.