Discovery Search on Android
  • 05 Dec 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Discovery Search on Android

  • Dark
    Light

Article summary

Summary

Discovery API is used for searching attractions, venues, events and classifications. We can even fetch detailed information of any attraction or venue or event, by passing its identifier. These examples are for Android developers. The examples are in Kotlin.

Features

List of APIs provided by DiscoveryAPI

  1. Attractions Search
  2. Venues Search
  3. Event Search
  4. Event Details
  5. Attraction Details
  6. Venue Details

DiscoveryAPI Setup

val tmDiscoveryAPI = TMDiscoveryApi.Builder()
    .apikey("<API KEY HERE>")
    .market("<TMMarketDomain..>")
    .build()

Accessing Discovery service

After creating the TMDiscoveryAPI instance as you just did during the setup, you'll now have access to different services pertaining to attractions, venues or events from this one instance to satisfy your needs as shown here:

fun getAttractionService(): DiscoveryAttractionService = tmDiscoveryAPI.getAttractionService()

fun getVenueService(): DiscoveryVenueService = tmDiscoveryAPI.getVenueService()
:::(Info) (Only for MFX Venue Details):::
fun getMFXVenueService(): MFXDiscoveryVenueService = mfxDiscoveryVenueService

fun getEventService(): DiscoveryEventService = tmDiscoveryAPI.getEventService()

Search methods with Examples

  1. Attractions Search

To get a list of attractions, you'll have to use the getAttractionSearchResults() method from the DiscoveryAttractionService and pass in the following:
- DiscoveryAttractionSearchCriteria object with the required keywordsFilter parameter
- TMMarketDomain representing the market you're searching in

Example:

val params = GetDiscoveryAttractionSearchParams(
     market = <TMMarketDomain..>,
    discoveryAttractionSearchParams = DiscoveryAttractionSearchCriteria(
         keywordsFilter = <Keyword to search...>
    )
)

val result = getAttractionService().getAttractionSearchResults(params)
  1. Venues Search

To get a list of venues, you'll have to use the getSearchResults() method from the DiscoveryVenueService and pass in the following:
- DiscoveryVenueSearchCriteria object with the required keywordsFilter parameter
- TMMarketDomain representing the market you're searching in

Example:

val params = GetDiscoveryVenueSearchParams(
      market = <TMMarketDomain..>,
      discoveryVenueSearchParams =  DiscoveryVenueSearchCriteria(
            keywordsFilter = <Keyword to search...>
       )
)

val result = getVenueService().getSearchResults(params)
  1. Events Search

To get a list of events, you'll have to use the getEventList() method from the DiscoveryEventService and pass in the following:
- TMDiscoveryQueryBuilder builder object that has a slew of parameters to cater to your needs

Example:

val queryBuilder = TMDiscoveryQueryBuilder.Builder()
     .keyword(<Event Query>)
     .pageSize(<Page size>)
     .sortBy(<TMDiscoveryQueryBuilder.SortBy...>)
     .build()

val result = getEventService().getEventList(queryBuilder)
  1. Event Details

To get details for specific event, you'll have to use the getEventDetailsResult() method from the DiscoveryEventService and pass in the following:
- eventId is the id of the event you're searching for

Example:

val result = getEventService().getEventDetailsResult(eventId)
  1. Attraction Details Search

To get details for a specific attraction, you'll have to use the overloaded getAttractionDetailsResult() method from the DiscoveryAttractionService and pass in the following:
- attractionId is the id of the attraction you're searching for

Example:

val result = getAttractionService().getAttractionDetailsResult(attractionId)
  1. Venue Details Search

To get details for a specific venue, you'll have to use the getVenueDetails() method from the DiscoveryVenueService and pass in the following:
- venueId is the id of the venue you're searching for

Example:

val result = getVenueService().getVenueDetails(venueId)

To get details for a specific venue on MFX markets, you'll have to use the getMFXVenueService() method from the MFXDiscoveryVenueService and pass in the following:
- venueCode is the id of the venue you're searching for
- systemId is the venue system key

Example

This is a Belgium URL: https://www.ticketmaster.be/venue/vorst-nationaal-forest-national-vorst-tickets/fna/107
The venue code is 107 and system id is fna

       val mfxVenueParams = MFXVenueInfoParams(
            venueCode = "107",
            systemId = "fna",
            market = TMMarketDomain.BE
        )
        getMFXVenueService().getVenueDetailsResult(mfxVenueParams)

Was this article helpful?