Quantcast
Channel: GitHub Api: User followers - paging? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Ionică Bizău for GitHub Api: User followers - paging?

$
0
0

The max number of items per page is 100, so using the per_page=100 querystring parameter will increase the result to have 100 users per page:

https://api.github.com/users/vojtajina/followers?per_page=100

Using the page querystring parameter, you have control to pagination. For example, to get the second page, you should add page=2:

https://api.github.com/users/vojtajina/followers?per_page=100&page=2

If you want to get all the followers you have to iterate the pages until you receive an empty array.


If you want to use this into a Node.js / JavaScript (on client) app, you can use gh.js–a library I developed which handles this:

var GitHub = require("gh.js");var gh = new GitHub({    token: "an optional token"});gh.get("users/vojtajina/followers", { all: true } function (err, followers) {    console.log(err || followers); // do something with the followers});

Viewing all articles
Browse latest Browse all 2

Trending Articles