I am using a Trello to record information publicly and I’m having issues with the update portion of the code. Creating a card for the trello works fine, updating it has gotten a little more complicated. Generally std::string errors are rather simple but I’ve been at this for about an hour and need assistance.
I’ve already checked the ID which will be provided in the gyazo it works fine. Tokey is the token and key, starting from ?, it should not be the issue. I highlighted the description and names in an attempt to see if id had to be first (perhaps I am missing information which I will further test as I wait for a response).
This is the code I am working with at the moment:
function UpdateCard(User)
local req = HttpService:GetAsync("https://api.trello.com/1/lists/5feadac75471a94a8c4f50a4/cards"..Tokey)
local jsontable = HttpService:JSONDecode(req)
local OnList = false
for _, card in pairs(jsontable) do
print(card.name)
if string.lower(card.name) == string.lower(User.Name) then
print("Player is on list.")
OnList = true
local PlayerName = User.Name
local Description = "KNOWN MEMBER"
local List = "5feadac75471a94a8c4f50a4"
local CardId = card.id
--name = PlayerName, desc = Description,
local data = {id = CardId}
local EncodedData = HttpService:JSONEncode(data)
print(CardId)
local Return = HttpService:RequestAsync({
Url = "https://api.trello.com/1/cards/"..CardId..Tokey,
Method = "PUT",
Body = EncodedData
})
local ReturnDecoded = HttpService:JSONDecode(Return)
print(ReturnDecoded)
end
end
if OnList == false then
print("Adding player to list...")
local PlayerName = User.Name
local Description = "NEW MEMBER"
local List = "5feadac75471a94a8c4f50a4"
local data = {name = PlayerName, desc = Description, idList = List}
local dataencoded = HttpService:JSONEncode(data)
local Return = HttpService:PostAsync("https://api.trello.com/1/cards"..Tokey.."&name="..PlayerName.."&desc="..Description.."&idList="..List, dataencoded)
local ReturnDecoded = HttpService:JSONDecode(Return)
print(ReturnDecoded)
end
end
This is the result:
https://gyazo.com/eeebe8140552d0e665d7b30e9137ad43