Home > database >  How to list all filenames under a directory using github api?
How to list all filenames under a directory using github api?

Time:09-22

I need to list all the file names under a directory of my repository.

The following api can list filenames and directories from root directory.

https://api.github.com/repos/username/repo-name/git/trees/master?recursive=1

Found no appropriate api to list directory wise!

CodePudding user response:

Use https://api.github.com/repos/{owner}/{repo}/contents/{path}

See documentation here: https://docs.github.com/en/rest/reference/repos#get-repository-content

  • Related