flyingbee
flyingbee

Reputation: 631

How to read the content of a file in a GitHub public repo

I am trying to use the GitHub API documented in https://developer.github.com/v3/repos/contents to read the content of a file. According to the document, it is to use "GET /repos/:owner/:repo/contents/:path". So I am trying to figure out how to actually use this API.

I am using Postman to test this API. For example, the owner name is "babybee", the repo name is "test_repo", what's the complete url for this? I tried "/repos/babybee/test_repo/contents/release/release_info.json" and obviously it doesn't work. Let's say, if the file path is "release/release_info.json" under root path, what would the actual complete url be for it to be working?

Upvotes: 1

Views: 2644

Answers (1)

Madhu Bhat
Madhu Bhat

Reputation: 15253

For the owner babybee, repo test-repo and file release/release_info.json, to get the contents, you should be using the API as below:

https://api.github.com/repos/babybee/test-repo/contents/release/release_info.json

Upvotes: 2

Related Questions