Suggested Searches
Let's learn to find search suggestions for events, attractions, and venues using Ticketmaster's Discovery API.
We'll cover the following
Find suggestions
What if we want to look up some events or attractions, but we don't have anything specific in mind? In that case, we can use the Discovery API's suggest endpoint to find search suggestions for events, attractions, and venues.
The URL for this endpoint is:
https://app.ticketmaster.com/discovery/v2/suggest
There are no required parameters for this endpoint. However, we can provide several optional search parameters for more customized suggestions. The table below gives an overview of a few of these parameters—you can visit this lesson to see the complete list:
Parameter | Type | Category | Description |
| string | optional | A keyword on which the search is performed. |
| string | optional | The radius of the area in which we want to search for events. |
| enum['miles', 'km'] | optional | The unit of the radius. The default value is |
| array[string] | optional | If provided, the results are filtered to return events with a start and end date within this range. |
| number | optional | The number of results to be returned per resource. The default value is |
| string | optional | If provided, the results are filtered based on the country. |
| string | optional | If provided, the search results are filtered based on the geohash. |
| array[string] | optional | This defines which resources to include in the response. It defaults to all resources, that is, |
The table below provides an overview of the keys of the response object:
Property | Type | Description |
| object | An object container. It contains a link to the current dataset. |
| object | An object container. By default, it contains four properties: |
As before, our primary focus is the _embedded
property. By default, it contains four properties—one for each resource (events, attractions, venues, products)—but we can specify which resources we want by defining the resource
query parameter.
Each property holds the suggestions in the form of an array of objects, with each object representing one suggestion. For example, the events
property will contain an array of objects, with each object containing the details of a single event. The number of elements in this array is defined by the size
query parameter.
Get search suggestions
Let's make a call to this endpoint, using none of the search parameters:
import jsonimport requestsapi_key = '{{API_KEY}}'response = requests.get('https://app.ticketmaster.com/discovery/v2/suggest',params={'apikey' : api_key}).json()print(json.dumps(response, indent=4))
By default, we get suggestions for all four resources, but we can customize the suggestions we get to our liking.
Customize suggestions
Let's also try to customize the suggestions we get using some of the optional parameters. We'll be using the geoPoint
, radius
, unit
, and resource
parameters:
import jsonimport requestsapi_key = '{{API_KEY}}'resource = ['venues', 'events']geo_hash = '9qqj7hezw'radius = 10unit = 'km'response = requests.get('https://app.ticketmaster.com/discovery/v2/suggest',params={'apikey' : api_key,'resource' : resource,'geoPoint' : geo_hash,'radius' : radius,'unit' : unit}).json()print(json.dumps(response, indent=4))
We've used the values above to specify that we want suggestions for only venues and events within a 10km radius of the location defined by the geohash—36.10513
, -115.175235
.
You can try changing the values of the parameters or even try using additional parameters—feel free to experiment!