我正在尝试从Github API获取一些数据。
我几乎完成了项目,但我还需要最后5名用户关注我。
我怎么能得到这个?在官方文档上也找不到谷歌的任何解决方案。
非常感谢
答案 0 :(得分:0)
If you use Github GraphQL API v4, you can use followers(last: 5)
in viewer
if you want to get the last 5 followers of the authenticated user :
{
viewer {
followers(last: 5) {
nodes {
login
}
}
}
}
Or for a specific user :
{
user(login: "bertrandmartel") {
followers(last: 5) {
nodes {
login
}
}
}
}
You can also use API v3 with /users/:user/followers but you would need to perform 2 or 3 requests :
Link
header to get the last page, check Travesing pagination