The pcall did not work, it still stops over an error, it’s because of the api module, but thanks for your help!
The error function here will actually stop the entire script from there, perhaps a warn or a print might be better if you want the script to continue running.
Tried that too, didn’t work.
Completely forgot about that, thanks for the reminder!
Hello, I sent you message. Sorry about that, but it could be a private.
Hm, can you help me, so the card description is the ban reason?
2020, is it still fixed yet? Literally, I’m getting an error from the API, Line 693. Anybody else?
Hey guys, this tutorial is a bit outdated and doesn’t have many options that are available within the Trello API. I’ve knocked up a quick module that pretty much allows you to submit any request method (though not the best way). I’m willing to alter this tutorial to using this module instead if it presents a better alternative.
Module Script
-- https://developers.trello.com/reference#introduction
--[[
GetEnveloped
March 13, 2020
Trello API
--]]
local API = {}
API.__index = API
---
local HttpService = game:GetService("HttpService")
---
function API.Connect (key, token)
local NewConnection = {}
setmetatable(NewConnection, API)
NewConnection.Key = key
NewConnection.Token = token
return NewConnection
end
---
function API:Request(url, method, filters)
local Token = self.Token
local Key = self.Key
local addon = "?key="..Key.."&token="..Token
for i,v in pairs(filters) do
addon = addon .. "&"..i.."="..v
end
local response = HttpService:RequestAsync(
{
Url = url..addon,
Method = method
}
)
if response.Success then
return HttpService:JSONDecode(response.Body)
else
warn("The request failed:", response.StatusCode, response.StatusMessage)
return nil
end
end
---
return API
Example Script
-- Example Code
local TrelloModule = require(script:WaitForChild("TrelloAPI"))
local Trello = TrelloModule.Connect("key","token")
-- tabl response
local Response = Trello:Request(
"https://api.trello.com/1/boards/boardid/lists", -- url request
"POST", -- method (POST, GET, PUT, DELETE)
{
name = "test list",
pos = "top"
} -- any filters or inputs etc
)
You can view the Trello API documentation here: Redirecter
In the example script, the url request should be the url at the bottom left of the image. The method should be what you see to the left of the url, in this case being “GET.”
Your filters or input requests are the ones in query parameters. This would go in the table within the example script after typing out your method.
If you would like this main thread to be edited to a much more detailed guide on requests, let me know and I’ll do that. Additionally, I can provide built-in requests within the module (i.e. Trello:GetBoardID(“board name”) like the previous module along with keeping the :Request() option for other api requests.
- Re-write tutorial and include built-in requests in module
- Re-write tutorial and don’t include built-in requests in module
- Don’t re-write tutorial
0 voters
Yes, we need a new tutorial. Please I really appreciate your work!
i thought about creating my own new version for the public to include more features. you should have built in functions as not everyone knows what they are doing.
This may be occurring because the data being sent or received is too large for Roblox to process. Many people don’t know that JSONEncode/Decode can fail and should be wrapped in a pcall.
I cannot stress enough that trello is not a database; if your dealing with datasets so large it can’t be processed, it may be time to get a database.
local TrelloAPI = require(game.ServerScriptService.Training:WaitForChild("TrelloAPI"))
print("Yes")
local BoardID = TrelloAPI:GetBoardID("SB Trainings Board 14418")
print("Yes")
local ListPolisID = TrelloAPI:GetListID("Police", BoardID)
print("Yes")
local PolisCards = TrelloAPI:GetCardsInList(ListPolisID)
print("Yes")
Players.PlayerAdded:Connect(function(Plr)
print("PlrAdded")
Plr.CharacterAdded:Connect(function()
print("CharAdded")
end)
end)``` Why won't this work?
What is not working exactly? The only issue I see is that you have not defined the Players
variable unless you defined it and did not include it in your reply.
I did, sorry. I just forgot to include it.
Your lack of context is what’s driving me mad. Why just post code and not incldue any detail whatsoever about an issue you’re having?
Basically, it gets up to the point of the second yes (local ListPolisID = TrelloAPI:GetListID("Police", BoardID)
and then just doesnt print anything after that.
Can you display the error it gives…? Because it won’t simply just do nothing, something gets printed in error.
As well, do you mind providing us with an URL to the Trello board?