Basic Attraction Details
Learn to retrieve attraction details using the Discovery API.
We'll cover the following
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 |
| string | required | The ID of the attraction we want the details for. |
| 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 |
| 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 |
| object | This object contains a link to the current dataset. |
| string | The type of the entity. For attractions, the value is |
| string | The ID of the attraction. |
| string | The name of the attraction. |
| string | A description of the attraction. |
| string | The URL to Ticketmaster's detail page for the attraction. |
| array[object] | The images of the venue. These are represented as an array of objects, with each object holding information regarding an image. |
| array[object] | The information regarding the attraction's classification (segment, genre, sub-genre, type, sub-type). |
| object | These can be any external links related to the attraction. |
| 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.
import jsonimport requestsapi_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:
import jsonimport requestsapi_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 anIndexError
for index values that are too large.