Reputation: 34145
I'm trying to get the same information out of GitHub that's shown on the https://github.com/notifications page. Unfortunately, the standard notifications API doesn't really match that view.
If I get the notifications from that API (even with participating=false
), I don't see all the items visible on the website. On the other hand, the API seems to be based on the last_read_at
idea, and things I've seen on the website don't disappear automatically from the notifications list.
Is there a way (without scraping the website) to obtain the same /notifications
view?
Upvotes: 8
Views: 615
Reputation: 701
So GitHub's API supports pagination for requests returning lists, so the API will return default of 30 notifications per page. What I suggest is setting the default size to 100 and then start from page 1 and call the next page till there is no results e.g. :
<https://api.github.com/notifications?page=1&per_page=100>; rel="next"
<https://api.github.com/notifications?page=2&per_page=100>; rel="next"
...and so on till you get an empty list then you stop
The rel="next" is a Link Header which is explained here: https://developer.github.com/v3/#pagination
Hope this helps
Upvotes: 2