Basic Event Details

Let's learn to fetch details for events using the Discovery API.

Event details

Apart from searching the events, one major use case of the Discovery API is to fetch details of events. To do this, we can use the events endpoint by passing the event ID as a URL parameter.

The URL for this endpoint is as follows:

https://app.ticketmaster.com/discovery/v2/events/{id}

This endpoint takes the ID of an event as a required URL parameter and a couple of optional query parameters. The table below gives an overview of these parameters:

Parameter

Type

Category

Description

id

string

required

The ID of the event we want the details for.

locale

string

optional

The locale in ISO code format. Multiple comma-separated values can be provided. When omitting the country part of the code (only en or fr) the first matching locale is used. When using *, it matches all locales. The default value is en.

domain

array[string]

optional

If provided, the results are filtered based on the domain they are available on.

As before, the response is a JSON object containing the details of the event. Let's take a look at some of the keys of this response object—you can visit this lesson to see the full details of all the keys:

Property

Type

Description

_links

object

An object container. It contains links to the datasets for the related venues and attractions, as well as a link to itself.

_embedded

object

An object container. It contains two properties, venues and attractions, that each hold details regarding the related venues and attractions respectively. The details are stored in the form of an array of objects, with each object representing one venue or attraction.

type

string

The type of the entity. For events, the value is event.

id

string

The ID of the event.

name

string

The name of the event.

description

string

A description of the event.

images

array[object]

The images of the event. These are represented as an array of the object, with each object holding information regarding an image.

dates

object

The dates of the event, including the start and end dates, as well as the dates when the general public can access the event.

sales

object

The information regarding the sales dates, including the start and end dates of public event sales and presales.

info

string

Any information regarding the event.

priceRanges

array[object]

The price ranges for the event tickets.

seatmap

object

The seat map for the event. The object contains a single property that holds the URL for the seat map.

classifications

array[object]

The information regarding the event's classification (segment, genre, subgenre, type, and subtype).

In the response objects for the endpoints we discussed previously, the _embedded property was our primary focus. However, in this case, the _embedded property only contains the details of the related venues and attractions. We'll discuss the details of these in later lessons.

Get event details

Let's try making a call to this endpoint using the event ID we saved earlier. If you want, you can replace the value of EVENT_ID with another valid event ID.

Press + to interact
import json
import requests
api_key = '{{API_KEY}}'
response = requests.get('https://app.ticketmaster.com/discovery/v2/events/{{EVENT_ID}}',
params = {
'apikey' : api_key,
}).json()
print(json.dumps(response, indent=4))

With that, we've successfully retrieved the details for an event. Let’s now look into some of the information that we get via this call, such as the seat map of the event.

The seat map of an event is a map or diagram of the venue’s seat layout for the event.

The response object includes a property called seatmap which further contains a single property called staticUrl. The staticUrl contains the URL of an image of the seat map for the event. Let’s take a look at the seat map for an event using these properties:

Press + to interact
import json
import requests
api_key = '{{API_KEY}}'
response = requests.get('https://app.ticketmaster.com/discovery/v2/events/{{EVENT_ID}}',
params = {
'apikey' : api_key,
}).json()
try:
# extracting the url of the seatmap
seatmap = response['seatmap']['staticUrl']
print(f'<img src={seatmap} width=500px>')

In the code above, we've simply made an API call to the events endpoint to fetch the details of an event. Then we've extracted the URL of the seat map (at line 13) and rendered it to the console using the HTML <img> tag.