簡體   English   中英

Trello 卡片更新 API

[英]Trello Card Update API

我一直在嘗試使用 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 Client 來執行我的 HTTP 方法。 最后我想將這些功能實現到一個小的 javascript 模塊中。 有誰知道我做錯了什么?

提前致謝!

好吧,已經有一段時間了,但現在我在過去幾個小時里遇到了同樣的問題。 對我來說,使用x-www-form-urlencoded主體的技巧沒有奏效。

對於還在苦苦掙扎的人:

1.) 您要更改的每個參數都必須在Query-Params 中定義 - 不需要正文

2.) 確保輸入 URL 為https://而不是http:// 這實際上解決了這個問題。

似乎 Trello Api 將每個http://請求解釋為 GET。

玩得開心! :-)

使用失眠休息客戶端,它使用 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM