SeatGeek API

I have been playing around with SeatGeek‘s API, and I have to say that it is really really good. Especially for a free service. You can get quite detailed information about anything from a Foo Fighters show to a Yankees game. As outlined in the API documentation, you can also search by date, venue, etc.

I wrote a simple piece of code to retrieve information about today’s NBA games for example. Give it a try.

import httplib
import json
from pprint import pprint
from datetime import date

root_url = "api.seatgeek.com"
query = "/2/events?datetime_utc=%s&q=nba" % date.today().isoformat()
conn = httplib.HTTPConnection(root_url)
conn.request("GET", query)
response = conn.getresponse()
data = response.read()
json_data = json.loads(data)
pprint(json_data)

JSON output for that code is below – just click to expand. Note that you are even told which one is home team and which one is away.

{u'events': [{u'datetime_local': u'2012-05-26T19:00:00',
              u'datetime_tbd': True,
              u'datetime_utc': u'2012-05-26T23:00:00',
              u'id': 823110,
              u'performers': [{u'home_team': True,
                               u'id': 2088,
                               u'image': u'http://cdn.seatgeek.com/images/bandshuge/band_2088.jpg',
                               u'images': {u'huge': u'http://cdn.seatgeek.com/images/bandshuge/band_2088.jpg',
                                           u'large': u'http://cdn.seatgeek.com/images/bands/band_2088.jpg',
                                           u'small': u'http://cdn.seatgeek.com/images/bandsmall/band_small_2088.jpg'},
                               u'name': u'Boston Celtics',
                               u'primary': True,
                               u'score': 327773,
                               u'short_name': u'Celtics',
                               u'slug': u'boston-celtics',
                               u'type': u'nba',
                               u'url': u'http://seatgeek.com/boston-celtics-tickets/'},
                              {u'away_team': True,
                               u'id': 2091,
                               u'image': u'http://cdn.seatgeek.com/images/bandshuge/band_2091.jpg',
                               u'images': {u'huge': u'http://cdn.seatgeek.com/images/bandshuge/band_2091.jpg',
                                           u'large': u'http://cdn.seatgeek.com/images/bands/band_2091.jpg',
                                           u'small': u'http://cdn.seatgeek.com/images/bandsmall/band_small_2091.jpg'},
                               u'name': u'Philadelphia 76ers',
                               u'score': 110294,
                               u'short_name': u'76ers',
                               u'slug': u'philadelphia-76ers',
                               u'type': u'nba',
                               u'url': u'http://seatgeek.com/philadelphia-76ers-tickets/'}],
              u'score': 6718.39,
              u'short_title': u'76ers @ Celtics',
              u'stats': {u'average_price': 350.03,
                         u'highest_price': 8640.0,
                         u'listing_count': 246,
                         u'lowest_price': 89.0},
              u'taxonomies': [{u'id': 1000000,
                               u'name': u'sports',
                               u'parent_id': None},
                              {u'id': 1030000,
                               u'name': u'basketball',
                               u'parent_id': 1000000},
                              {u'id': 1030100,
                               u'name': u'nba',
                               u'parent_id': 1030000}],
              u'title': u'Eastern Conf Semifinals: Philadelphia 76ers at Boston Celtics - Home Game 4',
              u'type': u'nba',
              u'url': u'http://seatgeek.com/76ers-celtics-tickets/5-26-2012-boston-massachusetts-td-garden/nba/823110/',
              u'venue': {u'address': u'100 Legends Way',
                         u'city': u'Boston',
                         u'country': u'US',
                         u'extended_address': None,
                         u'id': 1544,
                         u'location': {u'lat': 42.3664, u'lon': -71.0619},
                         u'name': u'TD Garden',
                         u'postal_code': u'02114',
                         u'score': 257282,
                         u'state': u'MA',
                         u'url': u'http://seatgeek.com/td-garden-tickets/'}}],
 u'meta': {u'geolocation': None,
           u'page': 1,
           u'per_page': 10,
           u'took': 3,
           u'total': 1}}

Let me know if you know / hear about similar APIs. One that gives you live score information for free would be nice.

Read more