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

HTTP Bad request error, how to get rid of this error?

So ive been trying to make this work, but no use. This is what the script is supposed to do;

It's supposed to send a http request to trello and if a certain strings match the ones in the script, it's supposed to change a value. However, at line 9 it gives me that error:

21:21:35.484 - HTTP 400 (HTTP/1.1 400 Bad Request) 21:21:35.485 - Stack Begin 21:21:35.486 - Script 'ServerScriptService.TrelloAPI', Line 422 - method GetCardID 21:21:35.486 - Script 'Workspace.GetRankMain', Line 9 21:21:35.487 - Stack End

tr = require(game.ServerScriptService.TrelloAPI)
bi = "State of Arizona"

-- State of Arizona

game.Players.ChildAdded:connect(function(plr)
local fo = game.ServerStorage.Ranks:WaitForChild(plr.Name)

if tr:GetCardID(plr.Name.." [1]",bi) then
fo.SOA.Value = "Tourist"

elseif tr:GetCardID(plr.Name.." [2]",bi) then
fo.SOA.Value = "Middle Class Citizen"

elseif tr:GetCardID(plr.Name.." [3]",bi) then
fo.SOA.Value = "Upper Class Citizen"

elseif tr:GetCardID(plr.Name.." [4]",bi) then
fo.SOA.Value = "Citizen on Trial"

elseif tr:GetCardID(plr.Name.." [5]",bi) then
fo.SOA.Value = "Arizona State Prison"

elseif tr:GetCardID(plr.Name.." [6]",bi) then
fo.SOA.Value = "Partnered Representatives"

elseif tr:GetCardID(plr.Name.." [7]",bi) then
fo.SOA.Value = "Capitol Staff"

elseif tr:GetCardID(plr.Name.." [8]",bi) then
fo.SOA.Value = "Supreme & Court Justice"

elseif tr:GetCardID(plr.Name.." [9]",bi) then
fo.SOA.Value = "Department Director"

elseif tr:GetCardID(plr.Name.." [10]",bi) then
fo.SOA.Value = "Mayor"

elseif tr:GetCardID(plr.Name.." [11]",bi) then
fo.SOA.Value = "House of Representatives"

elseif tr:GetCardID(plr.Name.." [12]",bi) then
fo.SOA.Value = "Senitor"

elseif tr:GetCardID(plr.Name.." [13]",bi) then
fo.SOA.Value = "Cabinet"

elseif tr:GetCardID(plr.Name.." [14]",bi) then
fo.SOA.Value = "Chief Court Justice"

elseif tr:GetCardID(plr.Name.." [15]",bi) then
fo.SOA.Value = "Speaker of the House"

elseif tr:GetCardID(plr.Name.." [16]",bi) then
fo.SOA.Value = "Lt. Governor"

elseif tr:GetCardID(plr.Name.." [17]",bi) then
fo.SOA.Value = "Governor"

elseif tr:GetCardID(plr.Name.." [18]",bi) then
fo.SOA.Value = "Founder"

else
fo.SOA.Value = "Guest"
end
end)

Thank you for anyone helps me out on this issue:)

1 comment

0

Trello would not use theis id format. Which is why your request was not found.

1 answer

✓ Accepted answer

Hiya! You need to specify a valid BoardID, the API has a function for this, also, you are performing incorrect usage for the function(s) in use. My experiences with the TAPI have been using POST & GET myself, however, this is what Line #2 should be:

bi = tr:GetBoardID("State of Arizona")

Also, you would not use GetCardID() for that. Here's an example of what you would use:

game.Players.PlayerAdded:connect(function(plr)
	local tr = require(game.ServerScriptService.TrelloAPI) --Load the TrelloAPI Module
	local br = tr:GetBoardID("BOARD_NAME") --Get the ID of the board
	local li = tr:GetListID("LIST_NAME",br) --Get the ID of the list, in the board
	for i,v in pairs(tr:GetCardsInList(li)) do --Do a for loop and run through all the cards in the list
		if v.name == plr.Name.. "[1]" then --Yes, the "name" value should be lowercase
		fo.SOA.Value = "Tourist"
		end
	end
end)

[NOTE: I have not tested this, I have based this on my experience with the Raw TrelloAPI and the TrelloAPI Module Documentation]

Hope this helps, if not, please let me know :)

ElmEditor

P.s: You shouldn't run this from a localscript or a script running on the Player/Client - as issues may arise when using DataModel > ServerScriptService

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