r121
r121

Reputation: 2738

How to get raw github data using github API

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

Upvotes: 2

Views: 2765

Answers (1)

VonC
VonC

Reputation: 1329082

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.

Upvotes: 2

Related Questions