I need help getting a player's favorite games

Hello I was looking at a post on how to get a players favorited games and the solution was just one link

https://www.roblox.com/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261

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?

(source: Is there an API to get a user's favorite games?)

edit: i also found another thing

GET /v1/users/{userId}/categories/favorites

but im not sure how to use this either.
(source for that: Inventory Api)

You will need to use the API via a proxy to achieve that. I found the following article useful when I did exactly that:

1 Like
https://www.roblox.com/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261

What don’t you understand? Just replace 261 with the user ID of the user you wish to query. Here’s a list of valid asset type IDs if you want to check a different asset type.
https://developer.roblox.com/en-us/api-reference/enum/AssetType

I’m talking about in a script not me doing it manually

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)

Hey i tried doing this however it’s not working.

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’m a little confused on what I did wrong

do you need the second argument? you can just do plr.UserId and also you didnt called the function

local Url = "https://inventory.roproxy.com/v1/users/"..plr.UserId.."/categories/favorites"

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 :frowning: