[英]Trello Card Update API
I have been trying to play around a little with Trello's REST API.我一直在尝试使用 Trello 的 REST API。 So far I am able to push some cards into the system with the regular POST call.
到目前为止,我可以通过常规的 POST 调用将一些卡推送到系统中。 What I would like to do now is to update a card with new information (ie new description, new comments or move the card to new list etc.).
我现在想做的是用新信息更新卡片(即新描述、新评论或将卡片移动到新列表等)。
Can I do this with a PUT- or a POST-method or do I first need to delete the old card and create a new one?我可以用 PUT 或 POST 方法来做到这一点,还是我首先需要删除旧卡并创建一张新卡? If so, could anybody give an example of how they're doing this?
如果是这样,有人可以举例说明他们是如何做到这一点的吗?
I've tried the following PUT-method, but it didn't seem to work:我尝试了以下 PUT 方法,但似乎不起作用:
PUT https://api.trello.com/1/cards/[existing card id]?key=[key]&token=[TOKEN]
and then I'll supply the parameters in the body of the request, like this:然后我将在请求正文中提供参数,如下所示:
{
"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",
}
By the way, I am using Postman Client to execute my HTTP-methods.顺便说一下,我正在使用 Postman Client 来执行我的 HTTP 方法。 In the end I want to implement these functions into a small javascript module.
最后我想将这些功能实现到一个小的 javascript 模块中。 Does anyone have an idea what I am doing wrong?
有谁知道我做错了什么?
Thanks in advance!提前致谢!
Allright so it has been quite some time but now I faced the same issue the last few hours.好吧,已经有一段时间了,但现在我在过去几个小时里遇到了同样的问题。 For me the trick with the
x-www-form-urlencoded
body didn't work out.对我来说,使用
x-www-form-urlencoded
主体的技巧没有奏效。
For the people that are still struggling:对于还在苦苦挣扎的人:
1.) Every parameter you want to change has to be defined in the Query-Params - no body is needed 1.) 您要更改的每个参数都必须在Query-Params 中定义 - 不需要正文
2.) make sure to type in the URL as https://
and not http://
! 2.) 确保输入 URL 为
https://
而不是http://
! This actually solved the issue.这实际上解决了这个问题。
It seems like the Trello Api interprets every http://
request as GET.似乎 Trello Api 将每个
http://
请求解释为 GET。
have fun!玩得开心! :-)
:-)
Using insomnia rest client, it worked using PUT + body content as json.使用失眠休息客户端,它使用 PUT + 正文内容作为 json。 Adding fields in the url wasn't necessary.
不需要在 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.