1

我希望能够在 trello 中存档(或删除)一张卡片,但使用 httppost。我在他们的 HTTPService 上使用 ROBLOX。这是我想出来的,但它似乎不起作用。

function DeleteCard(cardid)
    local url
    local cardi = tostring(cardid)
    url="https://api.trello.com/1/cards/"..cardi.."/actions"..getAddon() -- getAddon() is a function that returns the key to allow me to make modifications on the board. This works, I'm able to create lists/cards fine.
    local dat = {
    closed=true
    }
    local data = HS:JSONEncode(dat)
    local delc = HS:PostAsync(url,data)
    print(tostring(delc))
end

我尝试了许多不同的方法来做到这一点,但我似乎无法设置任何操作。它通常以 404 或 400 响应。使用此函数正确收集 cardid:

function GetCardID(name,boardid)
    local url
    url="https://api.trello.com/1/boards/"..boardid.."/cards"..getAddon()
    local tab=HS:GetAsync(url,true)
    local tabl=HS:JSONDecode(tab)
    for k,ta in pairs(tabl) do
        for p,t in pairs(ta) do
            if p=="name" and t==name then
                return ta.id
            end
        end
    end
end

它确实可以正确获取卡ID,我已经测试过了。

我查看了https://trello.com/docs/api/card/并尽力使用这些资源,但我就是不明白如何调用“删除”或如何将“操作”设置为存档.

4

1 回答 1

1

roblox 当前允许的唯一方法是 GET 和 POST。 这通常就足够了,但是在这种情况下,这意味着您不能使用任何使用 PUT 和 DELETE 的 Trello API 调用。

在您的情况下,删除卡需要 DELETE 方法,而存档卡需要 PUT 方法

但是,这并不意味着您不走运。您可以让自己的服务器(或第三方)从 ROBLOX 获取正常的 POST 请求,并使用正确的方法将它们发送到 Trello。

于 2015-06-09T14:17:43.787 回答