Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I use Catalog APIs?

So I scripted my script already:

hs = game:GetService("HttpService")

myTableJSON = hs:GetAsync("https://search.rprxy.xyz/catalog/json?Subcategory=16&SortType=3&ResultsPerPage=1", false)

myTable = hs:JSONDecode(myTableJSON)

I tried printing my table but when I do that I get this in my output: "table: 1FEA7820"

So I tried doing this: print(myTable[1]) and I get this in my output: "table: 1FDFDE20"

So my question is, How can I use the Catalog Data? I want to make a Catalog GUI thing. But I don't know how to access the Table...

1 comment

0

Please place code inside a Code Block. To insert a Code Block, click the blue Lua bubble button

1 answer

✓ Accepted answer

When you use the GetAsync and it returns a JSON table, and then when you decode it, it gets converted into a Lua table. If you do print(table) to a Lua table it just tells you the internal table index. If you want to peer inside, try:

for i, v in pairs(tableName) do
	print(i, v)
end

The table is identical to the table returned via JSON.

5 comments

0

I did that, and I got this in my Output: "1 table: 0B2A0678"

0

So is myTable a Table inside a Table?

0

Yes. What is returns to myTable is a list of tables, 1 table for every catalog item in the category that you requested." table: 0B2A0678" is one of the items, and you can loop through it.

0

So I do the samething, but just with myTable[1]?

0

Nevermind I tried it, it worked. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.