Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Trello Script not working, Argument 2 Missing or Nil?

So I have a trello script that I'm working on for a game, the getasync works fine, but when I try to post a card to a list, it doesn't work.

http = game:GetService("HttpService")
lists = "https://api.trello.com/1/lists/"
idagentreports = "5a406f099038ed77a724c89a"
auth = "&key="..tkey.."&token="..ttoken..""
local namefield = script.Parent.bg.agentreportnamebox.Text
local prooffield = script.Parent.bg.agentreportproofbox.Text

Above are my variables, tkey is my trello key and ttoken is my trello token.

script.Parent.bg.agentreportsubmitbtn.MouseButton1Click:connect(function()
		print("clicked")
		local postcard = http:PostAsync("https://api.trello.com/1/cards?name="..namefield.."&desc="..prooffield.."&pos=top&idList="..idagentreports..""..auth.."")
		print("submitted")
end)

Above is what I'm trying to submit, but it's not working. I tried adding http:JSONEncode, but that didn't work either.

The output says Argument 2 missing or nil.

1 comment

0

I accidentally missed a snippet of code, the postcard line is supposed to be local postcard = http:PostAsync("https://api.trello.com/1/cards?name="..namefield.."&desc="..prooffield.."&pos=top&idList="..idagentreports..""..auth.."")

1 answer

✓ Accepted answer

As the error says, you are missing an argument. If we take a look at this, we can see that PostAsync() requires TWO arguments. You have supplied one. Post requests are for SENDING data. You have intepreted this the wrong way. Roblox expects you to send data to that link. I would suggest a GetAsync(). I used it for google forms, to submit data. It works quite well. Since the data you are sending is in the link, the "?" and the "&", you only need a GET request.

This discussion is preserved as it was. New answers, comments, and votes are closed.