Hello!
I am trying to use the Catalog V2 API, specifically searching for items so I can grab a user’s created gamepasses (and in the future shirts, pants etc).
The documentation shows quite a lot of required parameters, so I attempted to accomodate for that.
local HttpService = game:GetService("HttpService")
local function getUserCreatedGamepasses(userId: number): {} | nil
local passes = {}
local cursor = ""
local limit = 120
repeat
local url = "https://{PRIVATE WORKING PROXY}/catalog/v2/search/items/details"
url ..= "?AssetTypeIds=34" -- AssetID Type for Gamepasses
url ..= "&BundleTypeIds="
url ..= "&CategoryFilter=0"
url ..= "&SortAggregation=0"
url ..= "&SortType=0"
url ..= "&CreatorType=0"
url ..= "&CreatorTargetId=" .. userId
url ..= "&CreatorName="
url ..= "&MaxPrice="
url ..= "&MinPrice="
url ..= "&Keyword="
url ..= "&IncludeNotForSale=false"
url ..= "&TriggeredByTopicDiscovery=false"
url ..= "&SalesTypeFilter=0"
url ..= "&Topics="
url ..= "&limit=" .. limit
url ..= "&sortOrder=Desc"
if cursor ~= "" then
url ..= "&cursor=" .. HttpService:UrlEncode(cursor)
end
local success, result = pcall(function()
return HttpService:GetAsync(url)
end)
if not success then
warn("Failed to fetch catalog items:", result)
return nil
end
local data = HttpService:JSONDecode(result)
if data.data then
for _, item in ipairs(data.data) do
table.insert(passes, item)
end
end
cursor = data.nextPageCursor
until not cursor
return passes
end
game.Players.PlayerAdded:Connect(function(plr)
local passes = getUserCreatedGamepasses(plr.UserId)
if passes then
for _, pass in ipairs(passes) do
local priceText = pass.price or "(no price info)"
print("Gamepass:", pass.name, "Price:", priceText)
end
end
end)
Omitted Proxy Url in the code snippet. Also broke down the disgustingly long URL so it’s somewhat readable.
Anyone familiar with the API and can see any issues with my logic/code? I keep getting HTTP Error Code 400.
Much appreciated!
