1

I want to know how to get this data from the GitHub API.

I know I can get this data as raw but is there any way to get this using GitHub API?

Here is the requested file:

https://github.com/graphql-compose/graphql-compose-examples/blob/master/examples/northwind/data/csv/employees.csv

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
r121
  • 2,478
  • 8
  • 25
  • 44

1 Answers1

1

As seen here, try

curl -GLOf -H "Authorization: token ${GITHUB_TOKEN?not set}" \
-H "Accept: application/vnd.github.v4.raw" \
  "https://api.github.com/repos/$ORG/$REPO/contents/$FILEPATH" -d ref="$REVISION"

In your case, for a public repository:

curl -GLOf -H "Accept: application/vnd.github.v4.raw" \
  "https://api.github.com/repos/graphql-compose/graphql-compose-examples/contents/examples/northwind/data/csv/employees.csv"

I just tested it, and got a file employees.csv with its raw content in it.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Is their any api limit for using github API? – r121 Nov 14 '21 at 15:19
  • @RishiPurwar Yes there is a "rate limit": https://docs.github.com/en/rest/reference/rate-limit. See also https://stackoverflow.com/q/45427275/6309 – VonC Nov 14 '21 at 15:51
  • @RishiPurwar As explained in https://github.com/forestgeo/learn/issues/148#issuecomment-439581637, The limit is 60 requests per hour for unauthenticated users (and 5000 for authenticated users). Official documentation: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting – VonC Nov 14 '21 at 15:59