0

我正在使用 Trello API,我想在特定列表上创建一张新卡。

我做到了,但不是我想要的方式

https://api.trello.com/1/lists/idList/cards?key=<myKey>&token=<myToken>&name=My+new+card+name&desc=My+new+card+description

我想在我的列表中创建一张新卡,但我想通过使用它来做到这一点:

newCard = [
{
    name: "myname",
    idList: "myIdList", 
    desc: "mydesc",
    pos: "top", 
    due: null
};
]

因为使用第一种方法时,当我尝试在名称或描述中添加空格时会出错(这是正常的,url 中不能有空格)

但是,当我尝试实现 newCard 变量时,它会引发错误,例如“idList 的值无效”,我不知道为什么?

也许有人可以给我一个如何做到这一点的例子?

4

1 回答 1

0

你试过没有“[]”吗?在 api 文档 https://developers.trello.com/get-started/start-building#create上:

var newCard = {
  name: 'New Test Card', 
  desc: 'This is the description of our new card.',
  // Place this card at the top of our list 
  idList: myList,
  pos: 'top'
};

对于列表 ID,它必须类似于“ https://trello.com/c/DcqBrqdx/1-target-card.json

于 2016-09-26T12:27:03.217 回答