How can I get the "used by" count by Github API?

Hi,

I’m wondering if I can get specific used by count of a repository

For example, https://github.com/apache/hadoop
image

The used by count here is 24123 now.

However, I cannot find any information about it by Github REST API.
If you have any suggestions or means to get this count, please help !!!

Hi there @TalentSSS :wave:

Thanks for bringing this up, and welcome to the community!

I had to search a bit for this but it looks like there is not an in-flight enhancement for REST or GraphQL that I can point to. And indeed, it’s not currently available. There are a handful of unique internal feature requests for the same however and for you, I would highly recommend submitting this suggestion via our feedback form, here:

Submissions get reviewed for consideration by our PM teams, who might not necessarily catch these community forum posts.

Cheers!

@TalentSSS

As nethgato suggested there is no existing API to achieve this. But if you need this you can achieve it using a CURL request.

curl -v --silent "https://github.com/apache/hadoop/network/dependents?package_id=UGFja2FnZS0xNzk5NzA2ODI%3D" 2>&1 | grep -i -B1 "Repositories" | tr '\r\n' ' ' | tr -s ' ' | grep -o "\s[0-9].*[0-9]*\s"

1 Like

@parithiban

Thanks, it works exactly!

The problem is that the package_id is still necessary to get from page. We can also get the Used by count if we can get package_id from it, which is not I want.

1 Like