I am attempting to get clothing items created by a group using the Catalog API, however I can only get up to 30 items using it. The URL I have been using it is https://catalog.roblox.com/v1/search/items/details?Category=3&CreatorType=2&IncludeNotForSale=true&Limit=30&CreatorTargetId=6641073 As you can see, it only displays 30 pieces of clothing as that’s the most the limit url parameter will allow me to. I am looking for someone to help me find some sort of workaround to be able to get all the clothing created by the group. Here is the code I have been using to get the JSON string (nodejs)
var body = [];
https.get("https://catalog.roblox.com/v1/search/items/details?Category=3&CreatorType=2&IncludeNotForSale=true&Limit=30&CreatorTargetId="+Id, (res) => {
res.on('data', (data) => {
body+= data;
});
res.on('end', () => {console.log(JSON.stringify(body))});
Thank you in advance and sorry for a question involving a different language.
This topic came back across my mind, so I decided to go figure it out. I now realize there is a URL parameter titled cursor. The response body will contain a value titled nextPageCursor. To get more than 50 results (formerly 30), loop through getting the results using recursion until nextPageCursor is null. Fixed js code:
const https = require("https");
function getClothingIds(Id) {
let body = "";
let nextCursor = ""
let final = []
function getResponse() {
https.get("https://catalog.roblox.com/v1/search/items?category=Clothing&creatorTargetId=3730015&creatorType=Group&limit=50&sortOrder=Desc&sortType=Updated&id=" + Id + "&cursor="+nextCursor,
(res) => {
res.on("data", (data) => {
body += data;
});
res.on("end", () => {
let json = JSON.parse(body);
nextCursor = json["nextPageCursor"];
final = final.concat(json["data"]);
body = "";
if (nextCursor != null) {
getResponse();
return;
}
console.log(final);
})
})
}
getResponse();
}