Segments, Genres, and Subgenres
Learn to fetch details for segments, genres, and subgenres using the Discovery API.
We'll cover the following...
Segment details
Segments are top-level classifications alongside types. They represent the primary genre of entities such as events and attractions. Some examples of segments include sports, music, and film.
The Discovery API offers a segments endpoint that we can use to fetch details for a particular segment. The diagram below gives an overview of this endpoint:
The URL for this endpoint is as follows:
https://app.ticketmaster.com/discovery/v2/classifications/segments/{id}
Here, {id}
is the ID of the segment we want to fetch the details for.
Request parameters
Apart from the id
URL parameter, we can provide a couple of optional query parameters as well. The table below gives an overview of all these parameters:
Parameter | Type | Category | Description |
| string | required | This is the ID of the segment 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 on the domain they are available on. |
Let's make a call to this endpoint using the segment IDs in the table below:
Segment | ID |
Sports | KZFzniwnSyZfZ7v7nE |
Music | KZFzniwnSyZfZ7v7nJ |
Arts & Theater | KZFzniwnSyZfZ7v7na |
Film | KZFzniwnSyZfZ7v7nn |
You can try to replace the value of the segmentId
variable on line 3 with an ID from the table above to fetch details for that specific segment:
import fetch from "node-fetch";const segmentId = "KZFzniwnSyZfZ7v7nE";const endpointUrl = new URL(`https://app.ticketmaster.com/discovery/v2/classifications/segments/${segmentId}`);const queryParameters = new URLSearchParams({apikey: "{{API_KEY}}",});const options = {method: "GET",};async function getSegmentDetails() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}getSegmentDetails();
In the code above we implement these actions:
Line 3: We define a variable ...