如何从Ticketmaster的开放API获取所有事件数据?

我正在尝试从Ticketmaster的API获取所有事件信息,并将特定的variables添加到mongoDB中。 不过,我目前使用的APIs仅限于每页200个事件。 因此,我不可能将活动信息与场地信息联系起来,因为这些信息被单独添加到mongoDB中。 一种解决scheme可能是通过更改API-url中的页面参数来遍历所有页面,或者也可能有其他选项?

我的代码看起来像这样(抱歉的长度..):

app.get('/tm', (req, res) => { axios // getting venues .get('https://app.ticketmaster.com/discovery/v2/venues.json?apikey=myApiKey&page=0&size=200&countryCode=DK') .then(response => { const venuesToBeInserted = response.data._embedded.venues.map(venue => { // preparing venues return { sourceID: venue.id, venue: venue.name, postalCode: venue.postalCode, city: venue.city.name, country: venue.country.name, countryCode: venue.country.countryCode, address: !!venue.address ? venue.address.line1 : null, longitude: !!venue.location ? venue.location.longitude : null, latitude: !!venue.location ? venue.location.latitude : null, source: 'ticketmaster' } }) // Create all venues at once Venue.create(venuesToBeInserted).then(venues => { console.log("venues inserted") axios // getting events and shows - note the page parameter in the api link .get('https://app.ticketmaster.com/discovery/v2/events.json?apikey=myApiKey&countryCode=DK&size=200&page=0') .then(response => { const eventsToBeInserted = response.data._embedded.events.map(events => { // preparing events const event = events._embedded.attractions[0] return { sourceID: event.id, name: event.name, slug: slugify(event.name).toLowerCase(), tags: !!event.classifications ? [event.classifications[0].genre.name, event.classifications[0].subGenre.nam] : [], // duplicate genres occur // possible tags from ticketmaster: type and subtype } }) // Create all events at once Event.create(eventsToBeInserted).then(events => { console.log("events inserted") const showsToBeInserted = response.data._embedded.events.map(show => { const event = events.find(event => event.sourceID == show._embedded.attractions[0].id); const venue = venues.find(venue => venue.sourceID == show._embedded.venues[0].id); if (!!event && !!venue) { return { event: event._id, venue: venue._id, timezone: show.dates.timezone, dateStart: !!show.dates.start.dateTime ? show.dates.start.dateTime : show.dates.start.localDate, tickets: !!show.priceRanges ? { minPrice: show.priceRanges[0].min, maxPrice: show.priceRanges[0].max, currency: show.priceRanges[0].currency }: {} } } }) // Let's see what we have created in the database Venue.find({}).select({ name: 1, slug: -1 }).limit(10).populate('event').populate('venue').then(events => { console.log(util.inspect(events)); }).catch(err => { console.error(err); }); }).catch( err => { console.error(err) }) }).catch( err => { console.error(err) }) }).catch(err => { console.error(err) }); }).catch(err => { console.error(err) }) })