Get user total starred count using Github API v3 -


from doc, can list repositories being starred using:

get /users/:username/starred 

but seems can't directly count of total starred repos of user.

am missing something?

this interesting question, , think have found answer it. let use github top user chart randomly choose ocramius 299 starred repos, available in json form this address.

now let try querying headers through curl -i "https://api.github.com/users/ocramius/starred". 1 hopeful-looking header:

link: https://api.github.com/user/154256/starred?page=2; rel="next", https://api.github.com/user/154256/starred?page=10; rel="last"

this header comes the pagination feature of api, happens if ask 1 record per page curl -i "https://api.github.com/users/ocramius/starred?per_page=1"?

link: https://api.github.com/user/154256/starred?per_page=1&page=2; rel="next", https://api.github.com/user/154256/starred?per_page=1&page=299; rel="last"

aha! if parse rfc5988 http header, can strip out page number tagged rel="last" , have correct answer of 299!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -