Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trello card delete help?

Asked by
Voltoxus 248 Moderation Voter
6 years ago

Im making a trello database for my admin and I got almost everything working except for delete.

How would you specify the delete request?

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

Reason im not using a PREMADE trello module is because I can't find one that works so I started making my own. I looked through one of them and there delete method sends a request to herokuapp which I assume sends a standard cURL request instead of using roblox HTTPService.

Any help would be appreciated.

2 answers

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago

Perhaps this can help, from your linked docs: https://developers.trello.com/reference/#delete-card

var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.trello.com/1/cards/id");

xhr.send(data);

This is the javascript called. Then if we look at: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open

we see

Syntax
XMLHttpRequest.open(method, url)

method
The HTTP request method to use, such as "GET", "POST", "PUT", "DELETE", etc. Ignored for non-HTTP(S) URLs.

url
A DOMString representing the URL to send the request to.

So that leaves you with the following problem. Roblox only has PostAsync and GetAsync, the delete request from the REST api is not implemented. See here: https://devforum.roblox.com/t/http-put-and-delete/11575/2

In the above board, people suggest you set the DELETE request through the URL, and indeed, the REST api should allow you to do anything through a POST request, including a DELETE request. I guess if nothing else works out you could always set up a php script somewhere that does the DELETE request for you when you POST to it from Roblox.

Hope this helps you out! Good luck!

0
Thanks for the help ill look into setting up a php. Voltoxus 248 — 6y
0
Was Wondering if you ever got this working i've been trying to and keep getting stuck. If you got it working would you be willing to tell me how? KamikazeJAM108867 38 — 5y
Ad
Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

So going off what Nonaz_jr was saying I did manage to find a way to get the delete function to work without having to use PHP but using plain lua

function T:RemoveCardUpdate(cardId) 
local http = game:GetService("HttpService")
local request = {
    Url = "https://api.trello.com/1/cards/"..cardId.."?key="..key.."&token="..token,
    Method = "DELETE"
}

local Response = http:RequestAsync(request) 
end

I put this at the bottom of a Trello API model that you can get some of the functions on it don't actually work which is why I implemented my own version of the delete one.

Here is the model: https://www.roblox.com/library/214265621/Trello-API-Original

put the code at the bottom before the return function and you can follow its set up procedure and then you'll be good it at least works for me and what I am doing so I don't know if this will work for you and hopefully this helps anyone else coming along in the future.

0
Yes, support for the full REST API was added! Nonaz_jr 439 — 4y

Answer this question