If you look at: http://developer.github.com/v3/pulls/ it shows you how to get pull requests for a given repository.
How do we get "my pull requests" from the GitHub API similar to the data displayed on the GitHub dashboard?
If you look at: http://developer.github.com/v3/pulls/ it shows you how to get pull requests for a given repository.
How do we get "my pull requests" from the GitHub API similar to the data displayed on the GitHub dashboard?
I asked Github directly. A rep told me to use the search endpoint. Search for issues owned by you that are open and of type pr
.
https://api.github.com/search/issues?q=state%3Aopen+author%3Adavidxia+type%3Apr
If you're using a python client lib like Pygithub you can do
issues = gh.search_issues('', state='open', author='davidxia', type='pr')
per_page
(max 100) and page
query parameters. For example, api.github.com/search/…
You can also use GraphQL API v4 to get all your pull requests :
{
user(login: "bertrandmartel") {
pullRequests(first: 100, states: OPEN) {
totalCount
nodes {
createdAt
number
title
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
or using viewer
:
{
viewer {
pullRequests(first: 100, states: OPEN) {
totalCount
nodes {
createdAt
number
title
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
{ viewer { } }
instead of { user(login: "...") }
to get the pullrequests of the currently auth-ed user.
Commented
Mar 28, 2019 at 9:46
First you have to realize that you must authenticate using either Basic Authentication or a token. Next you have to realize that there is no simple way to do this so you will have to be clever.
To be specific, if you probe https://api.github.com/issues
, you'll notice that the issues there have a hash called pull_request
which should have 3 URLs: html, diff, and patch. All three will be non-null if the issue is also a Pull Request. (Pro-tip: They're the same thing as far as GitHub is concerned…sort of.)
If you iterate over your issues and filter for ones where those attributes are not null, then you'll have your pull requests.
curl -u nddipiazza https://api.github.com/issues
and tell me what you see after typing in your GitHub password? Also what language/framework/wrapper are you using to communicate with the API?
Commented
Jul 4, 2013 at 3:44
[]
- what does that mean? (besides the obvious, that i don't have any issues)
Commented
Jul 5, 2013 at 20:13
/issues
or /user/issues
does this. According to github.com API docs developer.github.com/enterprise/2.8/v3/issues/#list-issues, these "List all issues assigned ... to the authenticated user" not created.
Commented
May 4, 2017 at 19:52