Google脚本添加Asana任务错误400

时间:2016-07-05 19:46:26

标签: google-apps-script asana-api

我使用以下示例尝试通过Google表格脚本创建Asana任务。

参考此SO问题并接受答案。 Creating Asana tasks from Google Apps Script

OP声称它在2015年的时候有用。现在,我在尝试使用自己的私钥等进行调试后收到以下错误。

Asana的网站上有关于API的体面文档,但是没有正确格式化JSON的示例可供参考......据我所知。

我已将此脚本添加到我的google工作表中,并在尝试使用我自己的PERSONAL_ACCESS_TOKEN,WORKSPACE_ID和ASSIGNEE调试testTask()时收到以下错误。

Request failed for app.asana.com/api/1.0/tasks returned code 400. Truncated server response: {"errors":[{"message":"Could not parse request data, invalid JSON","help":"For more information on API status codes and how to handle them, read th... (use muteHttpExceptions option to examine full response) (line 98, file "Code") 

1 个答案:

答案 0 :(得分:0)

您好,您遇到此问题,因为您发送给Asana的有效负载实际上没有正确格式化。如果您可以发送您发送给Asana的实际有效负载,我能够帮助您找出问题所在。最好的方法是为Asana创建一个curl请求。

此页面应包含示例(使用json)以帮助您入门:https://asana.com/developers/documentation/getting-started/input-output-options

我最好的猜测是你可能会有一些额外的"字符或缺失,导致你的json无效。

如果没有一个不适合你的具体例子,很难帮助你。祝你好运!