Access-git-blobs-via-apis

I am struggling to access my git file using git APIs.

curl -v -H “Authorization: token 111111111111111111111111111” -H “Accept: application/vnd.github.v3.raw+json” -i
https:// MYDOMAIN /api/v3/repos/ MYOWNERNAME / MYREPOSITORY /git/blobs/ {file sha value}

  • Error I am getting:

{ “message”: “Not Found”, “documentation_url”: https://developer.github.com/enterprise/2.20/v3/git/blobs/#get-a-blob }

Connection #0 to host MYDOMAIN left intact

  • we are using GitHub Enterprise solutions.
  1. I am not sure I have entered correct SHA value(from GITHUB server side) of the file also. Is there anyway to get the correct SHA value ?
  2. Is there someone that use this way to access the git file ?

Hey @AdimUser welcome to the community! I hope you’re able to find solutions to the answers you seek, and maybe have some fun along the way, too =)

While the Not Found message wouldn’t suggest this is an issue, I do notice that you’re using application/vnd.github.v3.raw+json, which does not seem to be an accepted media type:

https://docs.github.com/en/rest/reference/git#custom-media-types-for-blobs

Regardless, I think it would be helpful to know which version of GHE you’re using. Are you using GHE Cloud, or Server?

Also, what process did you follow to retrieve the SHA for your query?