while this may have made sense to the developer who solutioned it, it doesn’t make sense for me. How would I get the players favorited games from this link?
You could try and find an open Proxy, which is what you need. You can then use the following code to send the API request via the proxy and then to decode the return:
local Url = "https://some.proxy.com" -- obviously replace that with the one you find
local HttpService = game:GetService'HttpService'
local Module = {}
function JSONDecode(JSON)
local JSONTable = {}
pcall(function ()
JSONTable = HttpService:JSONDecode(JSON)
end)
return JSONTable
end
function GetAsync(Link)
local JSON = HttpService:GetAsync(Url .. "?q="..game.HttpService:UrlEncode(Link)) --you might need to mangle this based upon what the proxy requirements are
--print("Proxy Mod: ", JSON)
local Result = JSONDecode(JSON)
if Result.result == "success" then
return Result.response
else
warn(tostring(Link).." failed to fetch because "..tostring(Result.error))
return
end
end
Then to use then system:
local youURL = "https://www.roblox.com/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261" -- the query you want to send to the APIU
GetAsync(youURL)
game.ReplicatedStorage.Favorites.OnServerInvoke = function(plr, UserId)
local Url = "https://inventory.roproxy.com/v1/users/".. UserId .."/categories/favorites"
local HttpService = game:GetService'HttpService'
local function JSONDecode(JSON)
local JSONTable = {}
pcall(function ()
JSONTable = HttpService:JSONDecode(JSON)
end)
return JSONTable
end
local function GetAsync(Link)
local JSON = HttpService:GetAsync(Url .. "?q="..game.HttpService:UrlEncode(Link)) --you might need to mangle this based upon what the proxy requirements are
local Result = JSONDecode(JSON)
if Result.result == "success" then
return Result.response
else
warn(tostring(Link).." failed to fetch because "..tostring(Result.error))
return
end
end
end
I pass UserId through the remote function since in my game you search a players name and it shows information about them. So no it wouldnt be plr.UserID but just UserId (its passed through the remote event)
I think the URL is invalid but i need your help finding a valid one because I’d been searching for 4 hours now and can’t find anything