Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use Catalog APIs?

Asked by 7 years ago
Edited 7 years ago

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...

0
Please place code inside a Code Block. To insert a Code Block, click the blue Lua bubble button Validark 1580 — 7y

1 answer

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
7 years ago
Edited 7 years ago

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.

0
I did that, and I got this in my Output: "1 table: 0B2A0678" MRbraveDragon 374 — 7y
0
So is myTable a Table inside a Table? MRbraveDragon 374 — 7y
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. cabbler 1942 — 7y
0
So I do the samething, but just with myTable[1]? MRbraveDragon 374 — 7y
0
Nevermind I tried it, it worked. Thanks! MRbraveDragon 374 — 7y
Ad

Answer this question