Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trello Script not working, Argument 2 Missing or Nil?

Asked by
Valiux 27
6 years ago

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.

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.."") Valiux 27 — 6y

1 answer

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago

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.

Ad

Answer this question