Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script TrelloAPI:如何从谷歌应用程序脚本(GAS)发布卡片_Google Apps Script - Fatal编程技术网

Google apps script TrelloAPI:如何从谷歌应用程序脚本(GAS)发布卡片

Google apps script TrelloAPI:如何从谷歌应用程序脚本(GAS)发布卡片,google-apps-script,Google Apps Script,Google Apps脚本有一个UrlFetchApp方法,可以在Trello中创建卡片 如何使用它在trello中创建/修改卡?使用来自forUrlFetchApp和的sendHttpPost示例,我得出了以下结论: // This sample sends POST payload data in the style of an HTML form, including // a file. function createTrelloCard() { //POST [/1/c

Google Apps脚本有一个
UrlFetchApp
方法,可以在Trello中创建卡片


如何使用它在trello中创建/修改卡?

使用来自for
UrlFetchApp
和的
sendHttpPost
示例,我得出了以下结论:

 // This sample sends POST payload data in the style of an HTML form, including
 // a file.

 function createTrelloCard() {

   //POST [/1/cards], Required permissions: write
   var payload = {"name":"apiUploadedCard", //(required) Valid Values: a string with a length from 1 to 16384
                  "desc":"description", //(optional)Valid Values: a string with a length from 0 to 16384
                  "pos":"top", //(optional) Default: bottom Valid Values: A position. top, bottom, or a positive number.
                  "due": "", //(required) Valid Values: A date, or null
                  "idList":"52017776e823fa1d51000819", //(required)Valid Values: id of the list that the card should be added to
                  //"labels": ,//(optional)
                  //"idMembers": ,//(optional)Valid Values: A comma-separated list of objectIds, 24-character hex strings
                  //"idCardSource": ,//(optional)Valid Values: The id of the card to copy into a new card.
                  //"keepFromSource": ,//(optional)Default: all Valid Values: Properties of the card to copy over from the source.
                 };

   // Because payload is a JavaScript object, it will be interpreted as
   // an HTML form. (We do not need to specify contentType; it will
   // automatically default to either 'application/x-www-form-urlencoded'
   // or 'multipart/form-data')
   var url = 'https://api.trello.com/1/cards?key=[YourAppKey]&token=[UserToken]' //optional... -&cards=open&lists=open'-
   var options = {"method" : "post",
                  "payload" : payload};

   UrlFetchApp.fetch(url, options);
 }

免责声明:我还没有测试过这个。我从未编写过谷歌应用程序脚本或使用过Trello API。

很高兴看到你来解围。我必须包含appkey和token,知道如何包含它们吗?@AperezC我将其更新为我认为应该有效的版本。虽然很难说;他们的文档还有很多需要改进的地方。谢谢!它起作用了,我根据我所做的修改进行了编辑,但这完全是你的功劳。