Is there a way to download binary contents of assets through GraphQL?


Hello, I am a graphQL newbie. I am just getting interested in graphQL. So, I decided to use graphQL api instead of REST api in github.
Anyway, I want to know whether I can get a binary content of an asset through graphQL, not just information of an asset.(e.g. id, name, downloadURL)(cf. I cannot use “downloadURL” to download an asset because I use enterprise github)
With this link(, I can get a binary content of a single release asset with ease.
It seems that graphQL in github doesn’t support downloading a binary content of an asset yet, am I right?

c.f. I’ve already visited this link(Possible to query for a single release?)

If I am wrong, can you advice to me? Thank you.


Thanks for opening this topic @eubnara.

We don’t currently support downloading binary contents of assets in the GraphQL API. I’ve created an internal note for your schema request.

I can’t guarantee a timetable on when this will become available, but we’ll update you here once we add that capability.


@eubnara I was discussing this issue with the team and we were hoping to get more clarity on your use case. You mentioned that you cannot use downloadUrl because you use GitHub Enterprise. Is this because the version of GitHub Enterprise you are using does not support downloadUrl?


Sorry for ambiguity of my explanation.
I just want to deploy some releases through Github enterprise and use it like maven.
However, I cannot download a release using downloadUrl directly. (I cannot just use downloadUrl to download it by specifying access_tokens. I should use the method to download binary using REST API v3)

For example,

$ curl -L -O ${downloadUrl}
$ wget ${downloadUrl}

Someone in my team has done some tricks so that we can download a release by specifying ${GithubUrl}/api/v3/:org/:owner and access_token in pom.xml from Github enterprise using REST API v3. (In this scenario, we should find out the list of releases & release assets & download the latest one(if we do not provide specific release tag.) )

Another use case is that I know that the awesome feature of Github pages. With it, I think that I can use Github as an source repo & doc page & repo for global configuration or releases.
(Currently, we operate some document pages & mvn repo & source repo(Github) separately.)

However, I cannot provide a very big file through Github Pages. I learned that a very big file should be specified in releases after reading some docs.

Thank you for your caring! :smile:


Hi @eubnara!

In this particular case, I’m not sure using the GraphQL API makes a ton of sense - because of the way the GraphQL specification works, responses need to match the structure of requests, which means that even if the API was able to serve binary data, you would have to parse the JSON response and pluck out the file you were looking for, and it would likely need to be escaped using something like base64 in order to avoid parsing issues with the resulting data.

Unlike GraphQL, the REST API is able to redirect you to our specialized file-serving system in the event that the binary data is too large, which is important to ensure things like caching and performance can be met for all of our users! Due to the multi-resource nature of GraphQL responses, it’s not possible to ‘redirect’ to a single resource, which is why we’ve provided downloadUrl, to allow a user to queue one or more object downloads based on a response.

If I’ve misudnerstood anything, please let me know!