微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从get webhook响应嵌套json创建数组

如何解决从get webhook响应嵌套json创建数组

我设置的当前Zapier步骤创建了一个对外部服务的GET请求。该服务将回复嵌套的数据列表。我需要做的最后一步是向另一个API发出多个PUT请求,其中URL的一部分是GET响应中的值。没有固定数量的ID /时间,需要将其放入。

当前,如果我仅使用GET进行操作,则下一步是PUT,它将我需要放入的所有ID值(以逗号分隔的列表)放在API网址的末尾。我需要他们为每个ID分别提出PUT请求。

任何帮助将不胜感激。

This shows the response to the GET request (Images shows only the first part. There will are more in the response)

This is the PUT request. It currently puts them as a comma separated list. which causes an error. each of the values needs to process as a separate PUT.

解决方法

您可能要考虑编写自己的code step,以将嵌套的数据格式化为对象数组(JSON)。然后,您可以将数据返回到output并实现所需的效果,在下一步中,output数组中的每个项目都会执行PUT请求。

以下是Zapier关于此策略的说明:

Setting the output to an array of objects will run the subsequent steps multiple times — once for each object in the array. If Code by Zapier is the Zap's trigger and an empty array is returned,nothing happens. You can think of it like a polling trigger that did not get any results in the HTTP response. This functionality is exclusive to triggers — returning an empty array in a Code by Zapier action does not have the same effect.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。