Delete Trello cards

I’ve looked around and to be honest, I don’t understand urls and how they’re interpreted. The next game release is in a few hours so if someone could please tell me the code to delete a card in Trello that would be great. I know Roblox recently released code to do any request type with their new function ‘RequestAsync’. Using it you could potentially send a DELETE or PUT request.

Helps to read the Trello API docs.

https://developers.trello.com/reference#delete-card

Send a DELETE request via RequestAsync with a link to the card you want to delete.

local request = {
    Url = "https://api.trello.com/1/cards/CARD_ID?key=API_KEY&token=YOUR_TOKEN",
    Method = "DELETE"
}

local Response = HttpService:RequestAsync(request)

I don’t believe you need to include any headers, but make sure at the very least that your API key also has write access so that you’re able to delete the card.

3 Likes

That method seems to not work for some reason. Also, how do you delete a card via browser on a Trello board?

The request returned a table which contained:
StatusMessage Unauthorized
Success false
StatusCode 401
Body invalid key
Headers table: 0000023EA9577DC0

Your API key is invalid which is why the response tells you that the request was not processed as you do not have authorization. Ensure you are passing the correct API Key and Token.

local req = {
Url = “https://api.trello.com/1/cards/5cf993d6960824739934ac51?key=x&token=x”,
Method = “DELETE”
}
local send = game:GetService(“HttpService”):RequestAsync(req)
for i,v in pairs(send) do print(i," = ", v) end

– This code worked :smiley:

Mark the post with colbert’s code as solved if it was the solution.

Also a tip instead of looping through the response table you can just do

print(game:GetService("HttpService"):JSONEncode(send))