Search code examples
projectgithub-api

Why would the github API return empty list of projects for repo/owner?


When I'm calling the github API through the Octokit npm package or by a simple rest call I'll get an empty array back but a 200 success.

The repo in question is private and the projects in there are private too, but this shouldn't be a problem, shouldn't it? At least I didn't see this restriction mentioned somewhere.

The endpoint I call is:

https://api.github.com/repos/myowner/myrepo/projects

Anyone any ideas?

Thanks, Felix

UPDATE:

What I call is this:

GET https://api.github.com/repos/me-the-owner/myrepo/projects
Accept: application/vnd.github+json
Authorization: Bearer myAllAccessClassicToken
X-GitHub-Api-Version: 2022-11-28

Is there anything else that one should know to investigate the problem?


Solution

  • I think what I'm struggling with is what JerryK mentions here: Unable to create project in repository or organisation using GitHub REST API

    "So after looking around this is what i have found

    • The API no longer supports working with the new set of Projects. It only supports classic projects
    • Classic projects can no longer be created in GitHub
    • Thankfully, Github provides another approach, which is GraphQL
    • Using graphql you can perform all operations on the Projects, repositories etc Refer to the page https://docs.github.com/en/graphql/reference/mutations for more information "