Javascript Trello卡更新API
我一直在尝试使用Trello的RESTAPI。到目前为止,我能够通过定期的POST通话将一些卡片推入系统。我现在想做的是用新信息更新卡片(即新描述、新评论或将卡片移至新列表等) 我可以用PUT或POST方法来实现这一点,还是首先需要删除旧卡并创建新卡?如果是这样的话,有谁能举例说明他们是如何做到这一点的 我尝试了以下PUT方法,但似乎不起作用:Javascript Trello卡更新API,javascript,trello,Javascript,Trello,我一直在尝试使用Trello的RESTAPI。到目前为止,我能够通过定期的POST通话将一些卡片推入系统。我现在想做的是用新信息更新卡片(即新描述、新评论或将卡片移至新列表等) 我可以用PUT或POST方法来实现这一点,还是首先需要删除旧卡并创建新卡?如果是这样的话,有谁能举例说明他们是如何做到这一点的 我尝试了以下PUT方法,但似乎不起作用: PUT https://api.trello.com/1/cards/[existing card id]?key=[key]&token=[T
PUT https://api.trello.com/1/cards/[existing card id]?key=[key]&token=[TOKEN]
然后我将在请求主体中提供参数,如下所示:
{
"id": "542de77c832cff3f97884ad8",
"badges": {
"votes": 0,
"viewingMemberVoted": false,
"subscribed": false,
"fogbugz": "",
"checkItems": 0,
"checkItemsChecked": 0,
"comments": 0,
"attachments": 0,
"description": true,
"due": null
},
"checkItemStates": [],
"closed": false,
"dateLastActivity": "2014-10-03T00:02:04.042Z",
"desc": "test",
"descData": null,
"due": null,
"idBoard": "5417684179931e027c3d6bb9",
"idChecklists": [],
"idList": "5417684179931e027c3d6bbc",
"idMembers": [],
"idShort": 14,
"idAttachmentCover": null,
"manualCoverAttachment": false,
"labels": [],
"name": "new test #1 updated",
"pos": 131072,
"shortUrl": "https://trello.com/c/XYZ",
}
顺便说一下,我正在使用Postman客户端执行我的HTTP方法。最后,我想将这些函数实现到一个小的javascript模块中。有人知道我做错了什么吗
提前谢谢 好吧,已经有一段时间了,但在过去的几个小时里,我遇到了同样的问题。对我来说,使用
x-www-form-urlencoded
主体的技巧没有奏效
对于仍在挣扎的人们:
1.)要更改的每个参数都必须在查询参数中定义-无需正文
2.)确保键入URL为https://
,而不是http://
!这实际上解决了问题
TrelloAPI似乎将每个http://
请求解释为GET
玩得开心!:-) 使用rest客户端,它使用PUT+正文内容作为json。没有必要在url中添加字段
* Preparing request to https://api.trello.com/1/cards/card_id?key=your_key&token=some_token
* Current time is 2020-08-07T11:28:18.144Z
* Using libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.7 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.40.0
* Using default HTTP version
* Disable timeout
* Enable automatic URL encoding
* Enable SSL validation
* Enable cookie sending with jar of 1 cookie
* Found bundle for host api.trello.com: 0xa7f54da37800 [can multiplex]
* Re-using existing connection! (#4) with host api.trello.com
* Connected to api.trello.com (96.7.239.40) port 443 (#4)
* Using Stream ID: 3 (easy handle 0xa7f54da37800)
> PUT /1/cards/card_id?key=your_key&token=some_token HTTP/2
> Host: api.trello.com
> user-agent: insomnia/2020.3.3
> cookie: dsc=blablabla
> content-type: application/json
> accept: */*
> content-length: 20
{"desc":"123123123"}
* We are completely uploaded and fine
“然后我将把更新后的票证添加为JSON文件”-这是什么意思?您应该在请求正文中或作为url参数提供参数。感谢您的快速响应。这就是我真正的意思。很抱歉给你带来了困惑。我已经更新了我的问题。所以我希望,现在更清楚一点……您应该只在参数中包含您正在更改的字段。您试图设置的许多字段都是经过计算的,因此是只读的。请咨询您可以设置哪些字段。再次感谢。即使我只尝试使用PUT方法更新名称,也不会发生任何事情。。。我只在名称字段未更改的情况下以响应的形式取回票证。在Postman中,您希望使用
x-www-form-urlencoded
body。