cURL returns different response for Marketplace API than browser

Explanation

I’m trying to use the Roblox Marketplace API to get the latest UGC items but I’m having trouble with the query parameters not working.

I am using the example URL from the documentation which can be found below along with an explanation.

The following URL will search for the first 10 “Gear” items sorted by all-time (“SortAggregation”) and relevance (“SortType”) created by Roblox (“CreatorTargetID”):

https://catalog.roblox.com/v2/search/items/details?Subcategory=5&CreatorTargetId=1&SortType=0&SortAggregation=5&Limit=10

Problem

When I visit the URL using my browser it works fine and returns the expected. Still, when I try to access it from cURL it ignores all query parameters and shows all items ignoring the subcategory, sort, and creator target ID.

I am using the below command in Command Prompt.

curl https://catalog.roblox.com/v2/search/items/details?Subcategory=5&CreatorTargetId=1&SortType=0&SortAggregation=5&Limit=10

Attempted solutions

I tried changing the user agent but the same issue persists.

curl -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" https://catalog.roblox.com/v2/search/items/details?Subcategory=5&CreatorTargetId=1&SortType=0&SortAggregation=5&Limit=10

After lots of troubleshooting and researching, I’ve found most of the answer.

The documentation lists the queries to be used with the endpoint provided. The queries inside the article list the ones you can use for the v1 endpoint, not the v2 endpoint. The v2 endpoint is what AvatarEditorService:SearchCatalog() uses.

You’d need to use the v1 endpoint instead.

The v1 endpoint equivalent would be:

https://catalog.roblox.com/v1/search/items/details?Category=11&Subcategory=5&CreatorTargetId=1&SortType=0&SortAggregation=5&Limit=10

You’d need to put the category as 11 because Gears have been categorized as accessories for a while now. The article is very outdated.


Here’s the confusing thing though. Even after searching and experimentating for a while, I have no idea why curl returns different results. I made an HTTP request through JS code with accurate results, with the browser showing similar results. I cannot find out why curl is not properly parsing the queries.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.