rohitsakala
rohitsakala

Reputation: 399

Github API v3 Events to retrieve all events through api

I wanted to confirm that the GitHub API for events provides only the latest 300 events only or is can I get the entire list of events?

Upvotes: 5

Views: 1671

Answers (3)

VonC
VonC

Reputation: 1323115

Q4 2022:

My understanding is that GitHub's API doesn't limit you to 300 events, but instead only events that have occurred in the last 90 days

Q4 2024:

Upcoming changes to data retention for Events API, Atom feed, /timeline and /dashboard-feed features (Nov. 2024)

Currently, you are able to query back up to 90 days worth of events from data tables you have access to when reviewing or utilizing specific events features: Events API (including push events), Atom feed, /timeline, or /dashboard-feed.
On January 30th, 2025, we will be modifying the window of data retention for these features from 90 days to 30 days.

We are making this change to help GitHub continue to scale for all our users, while continuing to provide existing customers of these features with the ability to still query and view recent important event information.

The relevant APIs that will be affected are:
/events : List public events
/networks/{owner}/{repo}/events : List public events for a network of repositories
/orgs/{org}/events : List public organization events
/repos/{owner}/{repo}/events : List repository events
/users/{username}/events : List events for the authenticated user
/users/{username}/events/orgs/{org} : List organization events for the authenticated user
/users/{username}/events/public : List public events for a user
/users/{username}/received_events : List events received by the authenticated user
/users/{username}/received_events/public : List public events received by a user
/feeds : Get feeds

When can you expect the changes to occur?

On January 30th, 2025, we will be reducing the window that can be queried across those specified events features from 90 days to 30 days.
In advance of that, we will test this change for 24 hours on December 3rd, 2024.

Additional support

As part of this change, we are adding an additional event (DiscussionEvent) as a new EventType for the Events API.
This will allow you to query for an event related to Discussions that was not previously available.

We recommend leveraging a workflow that uses weekly or daily exports if you require further historical access.

Where can I learn more?

If you have concerns, comments, or feedback, please join us in this Discussion in the GitHub Community.

Upvotes: 0

proselotis
proselotis

Reputation: 11

My understanding is that GitHub's API doesn't limit you to 300 events, but instead only events that have occurred in the last 90 days

Only events created within the past 90 days will be included in timelines. > > Events older than 90 days will not be included (even if the total number of > events in the timeline is less than 300).

https://docs.github.com/en/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-user

If you are looking for the raw number of events that a user created on any day historically through their account, I created a script that works within GitHub's current HTML display and web scraping instead of using their API (as I can't find a way to acquire this kind of data through their API). As a note, the details of each event although can be displayed in the UI, is activated by private calls so I don't believe there is an easy way to access that data.

Upvotes: 1

Gras Double
Gras Double

Reputation: 16373

A bit of searching led me to this answer on another question: How do I get a list of all the GitHub projects I've contributed to in the last year?

The application is hosted at opensourcecontributo.rs. Simply input your GitHub username, then you will have two tabs to use, allowing you to list all the repositories you contributed to, and all your events. The source code is available on GitHub at tenex/opensourcecontributors.

I guess this application does what I suggested in my comment to your question: for recent data it may just use the API, and for older data it may use the timeline to enumerate repositories, then use the API to inspect these repositories. I definitely have to take a look at this code.

Upvotes: 1

Related Questions