events API - start_date_time - all events have the same date

Issue No. 199





Reported By

Jason Ansley




Not a Bug




25/Feb/15 9:16 PM EST


26/Feb/2015 7:30 PM EST


When I query events, every event I get back have the same start_date_time: today. This is the only date I can see in the results, so I assume it is supposed to be the scheduled date of the event? maybe it is user error? My request URL is: <a href="/events.json?sport=nba">/events.json?sport=nba</a> every date I get back is (for today) 2/25/2015 ... I can see in the HTML site that the scheduled dates are correct. So either that is not based on the XML, or I need to get the dates using a different method?

Closing Comment

The Events API method was written primarily to work in conjunction with downloading box scores. It's not ideal for getting a composite schedule. It would be better to have a new API method for this task. In the meantime, you could use the Team Schedule/Results ( for each team to build a composite schedule... or, yes, you would have to make an API request for each day of the season with the Events method. A quick shell script would look like: #!/bin/sh start=$(date -d &quot;Oct 28 2014&quot; +&quot;%s&quot;) end=$(date -d &quot;Apr 15 2015&quot; +&quot;%s&quot;) seconds=$start while [ $seconds -le $end ] do ymd=$(date -d &quot;Jan 1 1970 $seconds seconds&quot; +&quot;%Y%m%d&quot;) curl -H &quot;Authorization: bearer xxxx&quot; &quot;;date=$ymd&quot; -o $ymd.json let seconds+=86400 sleep 10 done


1. Erik Berg 25/Feb/2015 at 11:05 PM EST

What dates do you expect to be returned? Today is February 25, 2015. If you want events for a specific date, add a "GET /events.json?sport=nba&date=YYYYMMDD" parameter. With the same API request that you ran, I get back the following start_date_time values: "start_date_time":"2015-02-25T19:00:00-05:00" "start_date_time":"2015-02-25T19:30:00-05:00" "start_date_time":"2015-02-25T19:30:00-05:00" "start_date_time":"2015-02-25T20:00:00-05:00" "start_date_time":"2015-02-25T20:00:00-05:00" "start_date_time":"2015-02-25T20:00:00-05:00" "start_date_time":"2015-02-25T20:00:00-05:00" "start_date_time":"2015-02-25T20:00:00-05:00" "start_date_time":"2015-02-25T21:00:00-05:00" "start_date_time":"2015-02-25T21:00:00-05:00" "start_date_time":"2015-02-25T22:00:00-05:00" "start_date_time":"2015-02-25T22:30:00-05:00"

2. Jason Ansley 26/Feb/2015 at 1:26 AM EST

My mistake. User error. When i did not pass in a date, i was expecting a list of all scheduled events to come back. i was in a hurry and took the phrase, "By default, all events are returned" out of context. The docs were talking about optional filtering on 'sport', not what happens when you don't pass in a date. So in order to get the list of all future events, I need to make an API call for each day of the year? Anyway, sorry for the confusion, and thanks for the quick response. I would close this but I don't seem to have the option. Thanks.