Trello Card Update API

Trello Card Update API

本文关键字:API Update Card Trello      更新时间:2023-09-26

我一直在尝试使用Trello的REST API。到目前为止,我可以通过常规POST调用将一些卡推入系统。我现在想做的是用新的信息更新卡片(即新的描述、新的评论或将卡片移动到新的列表等)

我可以用PUT或POST方法来做这件事吗?还是我首先需要删除旧卡并创建一个新卡?如果是的话,有人能举个例子说明他们是如何做到这一点的吗?

我尝试过以下PUT方法,但似乎不起作用:

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://!这实际上解决了问题。

Trello Api似乎将每个http://请求都解释为GET。

玩得开心!:-)

使用失眠休息客户端,它使用PUT+body内容作为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