Get players gamepasses, shirts and pants

I am very new to apis and im trying to make a game like pls donate. (Just to get better at apis n stuff).
Ive tried looking at various topics but couldnt find an answer/were broken. Could someone help?

1 Like

You will need to use HttpService.

Here’s something I found that can help you! HERE

3 Likes

I tried it and it didnt work. I know I need HttpService but I cant find the exact proxy/url to post a get request to.

2 Likes

That tutorial is a little over a year old at this point. I was looking to do this too, not sure what url to find it at.

me neither i don’t really know, i’ll bumb your reply once i found a good one

1 Like

Hey,
I’ve written a function for personal use which does the same exact thing, but it tends to be slow on larger inventories. Here you go:

local MainData = {}

local function GetContent(Username, UserId,)
	local Market = game:GetService("MarketplaceService")
	-- Send a request to wake the server up
	local s, e = pcall(function()
		HTTPService:GetAsync("https://rblxproxy.darkpixlz.com")
	end)
	local SubCategories = {
		"2";
		"11";
		"12"
	}
	task.spawn(function()
		for i, v in ipairs(SubCategories) do
			local Success, Content = pcall(function()
				return HTTPService:GetAsync(`https://rblxproxy.darkpixlz.com/inventory/v1/users/{UserId}/inventory/{v}?pageNumber=1&itemsPerPage=9999`)
			end)
			task.spawn(function()
				for i, j in ipairs(HTTPService:JSONDecode(Content)["data"]) do
					local Data = Market:GetProductInfo(j, Enum.InfoType.Asset)
					if Data["Creator"]["Id"] ~= UserId then continue end
					table.insert(MainData, Data)
				end
				warn("Finished processing an item category")
			end)

		end
	end)
	-- Get passes
	local Success, Content = pcall(function()
		return HTTPService:GetAsync(`https://rblxproxy.darkpixlz.com/games/v2/users/{UserId}/games?limit=50`, true)
	end)

	if not Success then
		print(Content)
		MainData = {}
		GetContent(Username, UserId)
	end

	task.spawn(function()
		print(Content)
		for i, v in ipairs(HTTPService:JSONDecode(Content)["data"]) do
			local _Success, _Content = pcall(function()
				--local UniverseIdInfo = HTTPService:JSONDecode(HTTPService:GetAsync(`https://rblxproxy.darkpixlz.com/apis/universes/v1/places/{PlaceId}/universe`))["universeId"] or 0
				return HTTPService:GetAsync(`https://rblxproxy.darkpixlz.com/games/v1/games/{v["id"]}/game-passes?sortOrder=Asc&limit=50`, true)
			end)
			if not _Success then
				MainData = {}
				GetContent(Username, UserId)
			end
			_Content = HTTPService:JSONDecode(_Content)
			for i, j in ipairs(_Content["data"]) do
				table.insert(MainData, j)
			end
		end
		warn("Finished processing gamepasses")
	end)
end

It takes ~10 seconds on my inventory, but your speeds may vary. Feel free to use a proxy of choice, I’m just using my own because I wrote it.

Notes:

  • The gamepasses must be in the first 50 places, I didn’t make it loop through
  • My proxy sometimes will return a 500, but I think I patched that
  • It may be performance heavy
  • It does not yield your code, at least I don’t think

I’m using this in a case which requires you to know the price of assets by the user, so I made this function too:

local FinalData = {}

local function GetMatchForRobux(Username, ForPrice)
	for i, v in ipairs(MainData) do
		if v["IsForSale"] == false then
			continue
		end
		local Price = v["price"] or v["PriceInRobux"]
		table.insert(FinalData, v)

		if Price == ForPrice then
			print(`Found a match! {v["Name"] or v["displayName"]} is created by {Username} and is {Price} Robux!`)
			print(v)
			if v["sellerName"] ~= nil then
				-- only roblox API is camel case, so this is a gamepass
				return {`https://www.roblox.com/game-pass/{v["id"]}/`, `Found a match! {v["Name"] or v["displayName"]} is created by {Username} and is {Price} Robux!`}
			else
				return {`https://www.roblox.com/catalog/{v["ProductId"]}/`, `Found a match! {v["Name"] or v["displayName"]} is created by {Username} and is {Price} Robux!`}
			end
		end
	end

	print(`I couldn't find a match in {Username}'s creations for {ForPrice} Robux!`)

	return {`https://plsdonate.me/@{Username}`, `I couldn't find a match in {Username}'s creations for {ForPrice} Robux!`}
end

Note that it must be run after GetContent has completely finished or else it will not work

1 Like

The first snippet of code gets shirts, tshirts and pants right?

Yes, the first full function will get everything, and then gamepass from the first 50 places as well. Second one is just if you need to find a pass for a specific price like I did.

How much time will it take approximately? (1st code)

On my inventory, it takes about 11 seconds, but it’ll be a lot quicker on smaller inventories. I’ll work on finding a way to optimize it in the morning, if I find anything I’ll let you know. I know there’s an endpoint to multiget catalog details, but the main slow part is place info, it’ll go a lot faster depending on how many places you have on your account.

Thanks for the information, will definitely use this

2 Likes