I am trying to send an post request to an api (I made). I tested the same url that roblox should have send a post request to and it worked with no problems. But when I do it in roblox it does not work. No errors just does not work
--Server Script
local err, success = pcall(function()
responce = HttpService:PostAsync('https://api.rankblox.tk/promote?apiKey='.. tostring(ApiKey.Value).. '&Username='.. tostring(username).. '&RankerId='.. tostring(plr.UserId))
data = HttpService:JSONDecode(responce)
end)
print(responce)
print(data)
print(err)
lrisDev
(lrisDev)
July 4, 2022, 12:32am
2
How were you testing it before roblox?
I am using insomnia on windows
lrisDev
(lrisDev)
July 4, 2022, 12:36am
4
Can you show what you were running with it
Huh? Like insomnia or roblox or the api?
lrisDev
(lrisDev)
July 4, 2022, 12:38am
6
Insomnia, like exactly what you ran to test it
lrisDev
(lrisDev)
July 4, 2022, 2:06am
8
And it returns properly?
And no php errors on the website?
Works as it should on insomnia but does not work in roblox
04nv
(04nv)
July 4, 2022, 3:05am
10
if you are running it from server then you need a proxy most likely but that stuff doesn’t work on the client from what I 've heard
I am trying to send a request to a non roblox server (I own) would I still need a proxy?
As Discord banning Roblox API directly.
Its not a request to discord, its a request to my server that does not connect to discord or roblox
Okay then.
--Server Script
local responce --Scope.
local success, data = pcall(function()
responce = HttpService:PostAsync('https://api.rankblox.tk/promote?apiKey='.. tostring(ApiKey.Value).. '&Username='.. tostring(username).. '&RankerId='.. tostring(plr.UserId))
return HttpService:JSONDecode(responce)
end)
print(success)
print(responce)
print(data)
local success, data = pcall(function()
--responce = HttpService:PostAsync('https://api.rankblox.tk/promote?apiKey='.. tostring(ApiKey.Value).. '&Username='.. tostring(username).. '&RankerId='.. tostring(plr.UserId))
responce = HttpService:RequestAsync(
{
Url = 'https://api.rankblox.tk/promote?apiKey='.. tostring(ApiKey.Value).. '&Username='.. tostring(username).. '&RankerId='.. tostring(plr.UserId), -- This website helps debug HTTP requests
Method = "POST",
Headers = {
["Content-Type"] = "application/json" -- When sending JSON, set this!
}
}
)
return HttpService:JSONDecode(responce)
end)