简体   繁体   English

Zapier Cli - 应用程序在 Cli 中运行良好,但在 Zapier UI 中不起作用

[英]Zapier Cli - App works fine in Cli but not in Zapier UI

I have created an app in Zapier Cli, that calls Fancyhands API .我在 Zapier Cli 中创建了一个应用程序,它调用Fancyhands API Everything works fine in Cli as I get proper response from API as shown below.在 Cli 中一切正常,因为我从 API 得到了正确的响应,如下所示。

在此处输入图片说明

However, when I push this app to Zapier and try to use it.但是,当我将此应用程序推送到 Zapier 并尝试使用它时。 The API gives error, that one of the parameters is not formatted properly. API 给出错误,参数之一的格式不正确。

在此处输入图片说明

However, this shouldn't be the case, as I am sending same parameters from both CLI and the UI.但是,情况不应该是这样,因为我从 CLI 和 UI 发送相同的参数。 It looks like the Zapier UI is adding some extra encoding to the parameters.看起来 Zapier UI 正在向参数添加一些额外的编码。 Kindly suggest whats going on here?请建议这里发生了什么?

The root issue is that fancyhands expects a UTC timestamp for the call_window_start param (like 2020-02-29T11:00:00Z ).根本问题是,fancyhands 期望call_window_start参数的 UTC 时间戳(如2020-02-29T11:00:00Z )。 On the other hand, Zapier takes datetime fields and sends them to the developer in bundle.inputData as TZ-aware ( 2020-03-02T05:09:08-05:00 ).另一方面,Zapier 将datetime字段作为 TZ-aware ( 2020-03-02T05:09:08-05:00 ) 在bundle.inputData发送给开发人员。

The solution is therefore to remote the timezone data from the incoming timestamp.因此,解决方案是从传入的时间戳中远程获取时区数据。 Maybe something like new Date(bundle.inputData.call_window_start).toISOString() .也许类似于new Date(bundle.inputData.call_window_start).toISOString()

In your picture the datetime string is one time missing a Z at the end and the other time it has a Z .在您的图片中,日期时间字符串一次在末尾缺少Z ,而另一次则为Z
Try adding/removing the Z .尝试添加/删除Z

If that does not work something may be wrong with the HTTP headers.如果这不起作用,则 HTTP 标头可能有问题。 Locally and on Zapier you might be sending the content as a json the other time as a string.在本地和 Zapier 上,您可能会在其他时间将内容作为 json 作为字符串发送。
Make sure that also matches with the CLI.确保它也与 CLI 匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM