Home > Mobile >  How to get raw github data using github API
How to get raw github data using github API

Time:11-14

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

CodePudding user response:

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.

  • Related