Getting sha of a tree using HitHub API v3

I want to get the contents of a repo using GitHub API v3. I was thinking of using tree. But I’m not sure how to get the tree_sha. How do I get it?

The Git Data API is pretty complex because it pre-supposes a fairly deep understanding of how data is organized within the Git database structure. You can see the steps I had to go through to delete one file from one shallow directory by directly accessing the Git Data API in another post. And you can see a high-level overview of how the Git Data objects are organized in our help documentation.

Essentially, you have to get the reference to the tree object from a commit object or from another tree object (depending on how deeply nested the one you want is).

I hope that helps!