How to get list of PRIVATE repositories via api call

How to get list of PRIVATE repositories via api call

Using this command, it only retrieves the list of PUBLIC repositories…
curl -H “Authorization: token MYTOKEN” https://api.github.com/users/USERNAME/repos

P.S.
My token has all the checkmarks select to enable all permissions, and I still cannot retrieve the list of private repos.

I also tried this and it didn’t work…
curl -H “Authorization: token MYTOKEN” https://api.github.com/users/USERNAME/repos
-d “{“visibility”:“private”}”

I’m not sure this is the API you are looking for.
Try this one:

https://api.github.com/search/repositories?q=user:USERNAME

Without credentials, you will receive all public repositories of the user.
With credentials you will also receive the private ones.

Thanks, that worked. It retrieves both public and private repos…

curl -H “Authorization: token MYTOKEN” https://api.github.com/search/repositories?q=user:MYUSERNAME

I’m looking for an API which returns repos for an owner (a user or an org). In the docs, the search api has
user:USERNAME and org:ORGNAME ( see https://docs.github.com/en/github/searching-for-information-on-github/searching-for-repositories#search-within-a-users-or-organizations-repositories )

In my tests, both return the same results (ie they work for user:ORGNAME and org:USERNAME in addtion to user:USERNAME and org:ORGNAME)

Is this intended ? Is it going to continue to work ?What’s the difference between the two ?

Maybe the keyword “owner” should be used when referring to something that can be a user or an org.

Also
https://api.github.com/users/google/repos?per_page=100&page=11’ works
https://api.github.com/search/repositories?q=user:google&per_page=100&page=11’ fails:

{
  "message": "Only the first 1000 search results are available",
  "documentation_url": "https://docs.github.com/v3/search/"
}

Could you improve (and maybe merge?)
https://api.github.com/users/XXX/repos or https://api.github.com/orgs/XXX/repos to return all the results ?
Thanks