Skip to main content
Best answer

Why is my api request retrieving an array successfully in the developer but it is not in Zapier?


jacob_nolley
Forum|alt.badge.img

I built out a Search api request in the Zapier Developer and was able to successfully return an array.

When I built a zap using this information it returned the same data, but gave an error saying that the data was returned as an object rather than an array. I have attached photos of both the Developer Workspace and the zap error code.


One thing to note is that in the developer I am not getting any logs in the bundle, http, or console sections of the Test Your API Request section.

Screen Shot 2020-03-06 at 3.50.07 PM.pngScreen Shot 2020-03-06 at 3.49.53 PM.pngScreen Shot 2020-03-06 at 3.49.41 PM.png


Best answer by ikbelkirasanBest answer by ikbelkirasan

Hi @Danvers and @jacob_nolley

@jacob_nolley - It seems like you're returning an object instead of an array. Search actions require an array of objects as a response.

Can you switch to code mode and post a screenshot of the code in there? Basically, if the API response is an object, you would need to wrap it in an array first before you return it.

image.png


View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • 3731 replies
  • March 9, 2020

Hi @jacob_nolley - I moved your post to the Developer Discussion as that's the best place to ask these types of questions.

@ikbelkirasan I know that you have some experience with the Developer platform, are you able to help here?



ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Expert
  • 555 replies
  • Answer
  • March 10, 2020

Hi @Danvers and @jacob_nolley

@jacob_nolley - It seems like you're returning an object instead of an array. Search actions require an array of objects as a response.

Can you switch to code mode and post a screenshot of the code in there? Basically, if the API response is an object, you would need to wrap it in an array first before you return it.

image.png