Export to trello command not working

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

What does this output HTTP error codes are useful?

I have said that already in the post, it outputs nothing after concating or unpacking the table

Very strange… you should at least get a HTTP code from the request and not a blank table.

To be 100% sure can you print whats in the table.

for i, v in pairs(Response) do
  print(i, v, typeof(i), typeof(v))
end

@kingdom5 Screenshot_359 Oh I did get a forbidden error, it says the token is invaild, I’ll check it

The issue it that module.key was defined for both the key and the token causing this, but its very odd that i had to use that to be able to see the http error, well I learned something today and that is if i get a table that is blank use this script. Thanks :slight_smile:

2 Likes