我如何设置一个卡片在trello使用httppost存档



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

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/并尽我最大的努力使用这些资源,但我只是不明白如何调用"DELETE",或如何设置"actions"存档。

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

在您的例子中,删除卡片需要使用DELETE方法,存档卡片需要使用PUT方法。

然而,这并不意味着你运气不好。你可以有一个自己的服务器(或第三方)从ROBLOX获得正常的POST请求,并使用正确的方法将它们发送到Trello。

最新更新