简体   繁体   中英

How do you get the raw-url for a specific file from the Github API?

I can get as far as finding the JSON for the specific repository I'm trying to target but I'm having trouble finding the raw url 's of the files. Does the API have access to this data?

I read the API Documentation . It talked specifically about media types for the raw url's. I thought though, after trying to go through the Repositories documentation that maybe it was the Git Data section that might have the answer.

I also referenced this StackOverflow question . I just can't seem to figure it out. I just need to find the JSON array and then I'll be able to pull out what I need. Any help?

As illustrated in this Go-GiThub project , a media type wouldn't be part of a JSON struct.
It would be part of the request headers:
See github/github.go :

mediaTypeV3      = "application/vnd.github.v3+json"
req.Header.Add("Accept", mediaTypeV3)

In your case: application/vnd.github.v3.raw

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM