I'm trying to make a database where the game's Creator's ID is placed into a trello board, and then if their name is there, it does nothing, whereas if it isn't, the place gets deleted (yes, a bit mean, but come on...). I have read the documentation, stating the table returns as JSON, but when I attempt to decode said JSON, I get the error.
23:44:52.722 - Unable to cast value to std::string
23:44:52.722 - Stack Begin
23:44:52.723 - Script 'Workspace.TrelloAPI.Script', Line 28
23:44:52.723 - Stack End
In the documentation
--GetCardInfo([Card ID],[Board ID]) returns an table
--EX: {name="cardName",desc="cardDescription",...}
My script
local trello = require(script.Parent)
local boardID = trello:GetBoardID("AuthorisedPlaces")
local listID = trello:GetListID("PharmaMatic",boardID)
local cards = trello:GetCardsInList(listID)
print(game.CreatorId)
local alreadyPrinted = false
for a = 1,#cards do
if tostring(cards[a]) == game.CreatorId then
print'OK'
else
local cardId = trello:GetCardID("90119348",boardID)
if not alreadyPrinted then
print("Card id is "..cardId)
end
if cardId then
local cardInfo = trello:GetCardInfo(cardId)
if not alreadyPrinted then
print("Card info: "..game.HttpService:JSONDecode(cardInfo))
end
end
alreadyPrinted = true
end
end
If anybody knows the reason why, I'd be grateful to hear. Thank you!
Uses NStrike's Trello API
function getAddon()
if token~="" then
addon="?key=aded73d328dce4a0698a6744856b3326&token="..token
elseif getfenv(0).token~=nil then
local val=getfenv(0).token
addon="?key=aded73d328dce4a0698a6744856b3326&token="..val
else
error([[-Instructions
\n 1. Go to this link and click allow: https://trello.com/1/authorize?key=aded73d328dce4a0698a6744856b3326&name=Roblox+Api&expiration=never&response_type=token&scope=read,write
\n 2. Copy the token in the page sent to you
\n 3. Paste the token in the Value of Token]])
end
return "&key=aded73d328dce4a0698a6744856b3326&token="..token
end
--Irrelevant Code Here
function T:GetCardID(name,boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/cards"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/cards"..addon
end
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
function T:GetCardInfo(cardid)
--/1/boards/[board_id]/cards/[idCard]
local url
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..cardid..""..addon
else
getAddon()
url="https://api.trello.com/1/cards/"..cardid..""..addon
end
local re=HS:GetAsync(url,true)
local tab=HS:JSONDecode(re)
return tab
end

1 comment
The error occurs in the TrelloAPI script; please edit your question to include that one, or at least the relevant bits of it.