2015-06-05 63 views
1

我希望能夠在trello中存檔(或刪除)一張卡片,但使用httppost。 我在他們的HTTPService上使用ROBLOX。 這是我想出的東西,但它似乎並沒有工作。如何將trello中的卡片設置爲使用httppost存檔?

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」,或者如何設置「操作」以進行存檔。

+0

您正在使用'PostAsync',這意味着發出POST請求。也許有'DeleteAsync'來做DELETE請求嗎? –

回答

1

The only metods that roblox currently allows are GET and POST. 這通常是足夠的,但在這種情況下,這意味着您不能使用任何使用PUT和DELETE的Trello API調用。

而在你的情況下,deletion of a card requires the DELETE methodarchiving of a card requires the PUT method

但是,這並不意味着你運氣不好。您可以讓自己的服務器(或第三方)從ROBLOX獲得正常的POST請求,並使用正確的方法將它們發送到Trello。

相關問題