Question

Testing API polling based triggers

  • 25 October 2023
  • 0 replies
  • 80 views

Hey Zapier team, 
I can see the “Test” step in API polling based triggers basically tries to poll for recent records from the endpoint defined in `perform` step. Its easy and simple when the API returns the records matching the output fields as defined. As it gives the user a confidence in how the data might look like. 

Consider this case: 

  1. The user selects an input choice from dynamic dropdown. Say ‘UserID’ : ‘123’. 
  2. My perform setup is an API call to say GET  ‘booksRead/user?UserID=123’. Query parameter populated from bundle data. The API returns a response like {currentlyReading: {}, userDetails: {id: 123,isLoggedIn: true, isAdmin: false} }, currentlyReading this value gets updated whenever the user picks up a book to read. 

  3. So, zapier polls for change in the response and hence a change in currentlyReading every certain interval, and whenever there is a change, say userID:123 picked up ‘ZapierGuide’ to read, I make the perform return a composite object something like this: 
    { user: {id: 123, isLoggedIn: true, isAdmin: false} ← UserDetails,     booksRead: {bookId: ‘book123’, bookTitle: ‘ZapierGuide’}} ← BookDetails

Say as a zap creator, I want to know what all properties of the book object are exposed to be used in any action later. But since during the creation of the zap this book object might not be present in the API response, I would not know what fields are available. 

There should be an option to show either some static data [static composite json object made of both user and book details], or, if I can create a dummy record by calling a few more APIs (say a call that gives me historical data of currentlyReading of some dummy user etc) that I can show to the user. 

I can see that I can use performList in instant triggers to make a few async calls and show either fallback static data or real time data that I fetch from my platform. 

TLDR : Is there any way to make few async API calls to create the test record to show to user in API polling based triggers? 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.