How could i get the id of an item from Catalog API?

I’d like to know how could i print out the id of gears from the catalog API.

But the problem is, whenever i try to print it, it always returns ‘nil’
image

I’ve tried putting [1] after data(as seen in example), but it just returns nil


image

local HttpService = game:GetService("HttpService")

local URL_ASTROS = "https://catalog.roproxy.com/v1/search/items/details?Subcategory=5&CreatorTargetId=1&Limit=10"

-- Make the request to our endpoint URL
local response = HttpService:GetAsync(URL_ASTROS)

-- Parse the JSON response
local data = HttpService:JSONDecode(response)

print(data[1])

How could i print the “1” section?

In the dictionary it returns, to get the content you must access data

local HttpService = game:GetService("HttpService")

local URL_ASTROS = "https://catalog.roproxy.com/v1/search/items/details?Subcategory=5&CreatorTargetId=1&Limit=10"

-- Make the request to our endpoint URL
local response = HttpService:GetAsync(URL_ASTROS)

-- Parse the JSON response
local data = HttpService:JSONDecode(response)
print(data.data[1])
1 Like

Oh, wow. The variable name really confused me, thank you so much!

1 Like

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