So I have a export command that exports users points to a trello, however it doesn’t export to the trello, when using print(Response)
it prints a “table:” and then a lot of number and letters, so I use table.concat and then it prints just blank, so i used unpack and that printed nothing, I don’t see what I could be doing wrong inless maybe i’m using RequestAsync wrong?
My code is below:
local get = http:GetAsync('https://api.trello.com/1/boards/'..module.Trello..'/lists?key='..module.Key..'&token='..module.Token,true)
local tab=http:JSONDecode(get)
print("ok this worked")
for _,v in pairs(tab) do
print("looking for points list")
if v.name:match('^Points%s?$') then
print("found")
local musget = http:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards?key='..module.Key..'&token='..module.Token,true)
local mustab = http:JSONDecode(musget)
local children = game.ServerStorage.unofficaltraininglog:GetChildren()
for i, child in ipairs(children) do
print("checking users in the log to see if they have a card already, if they do we will update it, if they don't we will make them one :D")
local wasuserexported = false
local userid = game.Players:GetUserIdFromNameAsync(child.Name)
local robloxrootuser = game.Players:FindFirstChild(child.Name)
for _,m in pairs(mustab) do
if m.name:match(userid) then
wasuserexported = true
local howmanypointsearnedstat= Instance.new("NumberValue")
howmanypointsearnedstat.Name = "Points Earned"
howmanypointsearnedstat.Parent = robloxrootuser.leaderstats
howmanypointsearnedstat.Value = child.Points.Value
local getnewpointthing = m.desc + child.Points.Value
print(getnewpointthing)
local request = {
Url = "https://api.trello.com/1/cards/"..m.id.."?desc="..getnewpointthing.."&key="..module.Key.."&token="..module.Key,
Method = "PUT"
}
local Response = HttpService:RequestAsync(request)
print(unpack(Response))
end
end
if wasuserexported == false then
print("user has no card making card!")
local wasuserexported = false
local userid = game.Players:GetUserIdFromNameAsync(child.Name)
local robloxrootuser = game.Players:FindFirstChild(child.Name)
wasuserexported = true
local howmanypointsearnedstat= Instance.new("NumberValue")
howmanypointsearnedstat.Name = "Points Earned"
howmanypointsearnedstat.Parent = robloxrootuser.leaderstats
howmanypointsearnedstat.Value = child.Points.Value
local getnewpointthing = child.Points.Value
print(getnewpointthing)
local request = {
Url = "https://api.trello.com/1/cards/?idList="..v.id.."&name="..userid.."&desc="..getnewpointthing.."&key="..module.Key.."&token="..module.Key,
Method = "POST"
}
local Response = HttpService:RequestAsync(request)
print(unpack(Response))
end
end
end
end
The prints that I used for debugging all went thru and there where no warnings or errors. Nor the PUT or POST request works, and its the right API link