I have this, but if there is another way it’d be great.
The issue with this is I don’t know how to get more than 100 items, is there a way to go to other pages or is this all it lists?
I just need the items name, rap and id.
https://inventory.roblox.com/v1/users/1/assets/collectibles?assetType=Hat&sortOrder=Asc&limit=100
(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)
He said he wants to get more than 100 items, so your solution doesn’t solve his problem.
100 is the cap.
10, 25, 50, and 100
Here’s the solution.
The API listed there has the same limitation of only 100 limiteds.
Exactly, that answers it, since the limit is indeed 100.
The limit is 100, but it in the response there is a cursor, you send that with the request to get the next page. If you’re making a scraper you just check if the next page cursor is the same as the last and that’s how you know if you’re on the last page.
An example of the next page for that example,
https://inventory.roblox.com/v1/users/1/assets/collectibles?assetType=Hat&sortOrder=Asc&limit=100&cursor=27504591_1_be630a7ab4e45472c52cc084b11f3317
You just add &cursor=CURSORHERE to the end of the URL.
Note that it should be &cursor=
if there’s already a ?something=
in the URL, so the link that you posted should be https://inventory.roblox.com/v1/users/1/assets/collectibles?assetType=Hat&sortOrder=Asc&limit=100&cursor=27504591_1_be630a7ab4e45472c52cc084b11f3317
Thank you, I’ll edit my reply.
What I’d do with this is take the next page’s cursor, get the data of that, and repeat. (Recursively acquire the data.) Until you got all you need.
Never mind. Thanks.
Here’s an implementation I wrote which achieves this.
local http = game:GetService("HttpService")
local get = http.GetAsync
local jsonDecode = http.JSONDecode
local proxyUrl = "roproxy.com" --Change this to your proxy's domain.
local baseUrl = "https://inventory."..proxyUrl.."/v1/users/1/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local function getCollectiblesRecursive(collectibles, cursor)
collectibles = collectibles or {}
cursor = cursor or ""
local requestUrl = string.format(baseUrl, cursor)
local success, result = pcall(get, http, requestUrl)
if success then
if result then
local success2, result2 = pcall(jsonDecode, http, result)
if success2 then
if result2 then
for _, collectibleItem in ipairs(result2.data) do
table.insert(collectibles, collectibleItem)
end
cursor = result2.nextPageCursor
if cursor then
return getCollectiblesRecursive(collectibles, cursor)
else
return collectibles
end
end
else
warn(result2)
end
end
else
warn(result)
end
task.wait(1)
return getCollectiblesRecursive(collectibles, cursor)
end
local collectibleItems = getCollectiblesRecursive()
for _, collectibleItem in ipairs(collectibleItems) do
for collectibleProperty, collectibleValue in pairs(collectibleItem) do
print(collectibleProperty, collectibleValue)
end
end
The script outputted roughly 13,000 lines of information relating to collectibles.