- Print
- DarkLight
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
- Attractions Search
- Venues Search
- Event Search
- Event Details
- Attraction Details
- 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()
fun getEventService(): DiscoveryEventService = tmDiscoveryAPI.getEventService()
Search methods with Examples
- Attractions Search
To get a list of attractions, you'll have to use the
getAttractionSearchResults()
method from theDiscoveryAttractionService
and pass in the following:
-DiscoveryAttractionSearchCriteria
object with the requiredkeywordsFilter
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)
- Venues Search
To get a list of venues, you'll have to use the
getSearchResults()
method from theDiscoveryVenueService
and pass in the following:
-DiscoveryVenueSearchCriteria
object with the requiredkeywordsFilter
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)
- Events Search
To get a list of events, you'll have to use the
getEventList()
method from theDiscoveryEventService
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)
- Event Details
To get details for specific event, you'll have to use the
getEventDetailsResult()
method from theDiscoveryEventService
and pass in the following:
-eventId
is the id of the event you're searching for
Example:
val result = getEventService().getEventDetailsResult(eventId)
- Attraction Details Search
To get details for a specific attraction, you'll have to use the overloaded
getAttractionDetailsResult()
method from theDiscoveryAttractionService
and pass in the following:
-attractionId
is the id of the attraction you're searching for
Example:
val result = getAttractionService().getAttractionDetailsResult(attractionId)
- Venue Details Search
To get details for a specific venue, you'll have to use the
getVenueDetails()
method from theDiscoveryVenueService
and pass in the following:
-venueId
is the id of the venue you're searching for
Example:
val result = getVenueService().getVenueDetails(venueId)