Basic Attraction Details

Learn to retrieve attraction details using the Discovery API.

Attraction details

Earlier, we briefly explored the attractions endpoint and used it to search for several different attractions, but that's not all we can do with this endpoint. Like the events endpoint, we can use it to retrieve details for an attraction simply by passing the ID of an attraction as a URL parameter.

The URL for this endpoint is:

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

Here, {id} is the ID of an attraction. Apart from this URL parameter, this endpoint also takes 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 attraction we want the details for.

locale

string

optional

This is 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 always, the response is a JSON object containing the details of the attraction. Let's take a look at some of the properties of this response object—you can visit this lesson to see the full details of all the properties:

Property

Type

Description

_links

object

This object contains a link to the current dataset.

type

string

The type of the entity. For attractions, the value is attraction.

id

string

The ID of the attraction.

name

string

The name of the attraction.

description

string

A description of the attraction.

url

string

The URL to Ticketmaster's detail page for the attraction.

images

array[object]

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

classifications

array[object]

The information regarding the attraction's classification (segment, genre, sub-genre, type, sub-type).

externalLinks

object

These can be any external links related to the attraction.

upcomingEvents

object

These objects are the counts of the upcoming events of the attraction.

Getting attraction details

Let's try making a call to this endpoint by using attraction IDs from the table below:

Attraction

ID

Phoenix Suns

K8vZ9171oZf

Los Angeles Lakers

K8vZ91718T0

Boston Red Sox

K8vZ9171okf

The Weeknd

K8vZ9172Ln7

Atif Aslam

K8vZ917GGnf

Backstreet Boys

K8vZ91719tf

Try replacing the value of the attraction_id variable on line 5 with an ID from the table above to retrieve details for that specific attraction.

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

With that, we've successfully retrieved the details for an attraction. Now, let's try rendering the images contained within the images array to the console.

Render images

The response object includes an array called images, similar to the images array we get from the events endpoint. However, unlike events, we don't have a dedicated endpoint to fetch images for an attraction, so we'll have to stick to the attraction details endpoint for this purpose.

Let's try extracting the images from the response object like so:

Press + to interact
import json
import requests
api_key = '{{API_KEY}}'
attraction_id = 'K8vZ9171oZf'
response = requests.get('https://app.ticketmaster.com/discovery/v2/attractions/' + attraction_id,
params = {
'apikey' : api_key,
}).json()
image_url = response['images'][0]['url']
print(f'<img src={image_url} width=500px>')

You can try changing the value of the attraction_id variable on line 5, or changing the index on line 12 to fetch different images.

Note: The length of the images array varies across different responses, so you might get an IndexError for index values that are too large.