Fils
Fils

Reputation: 47

How to get number of user repositories using GitHub api?

I'm trying to get number of repositories of user, without getting all repos using api.github.com/users/userName/repos. Is there any solution to do this?

Thanks

Upvotes: 0

Views: 378

Answers (2)

Mohssine Aboutaj
Mohssine Aboutaj

Reputation: 31

Yes, you can do like this

Note: in this example i'm using javascript

fetch("https://api.github.com/users/YOUR_USERNAME")
  .then((response) => response.json())
  .then((data) => console.log(data.public_repos));

Upvotes: 0

ashmaroli
ashmaroli

Reputation: 5444

The data at https://api.github.com/users/userName includes the key public_repos that denotes the number of public repositories for the given user

Upvotes: 1

Related Questions