I’m attempting to retrieve asset ids for items in the catalog, I believe this has been done correctly as it’s printing out the ids, however, I’m attempting to store those ids into a table within a datastore.
I’ve searched for information regarding tables and datastoring, however, most of them are storing intvalues, strings, etc… I’m trying to store id values that are being retrieved in the same script.
The reason I’m storing these ids as opposed to simply retrieving them everytime a server starts up is due to execution limitations within the proxy.
local DDS = game:GetService("DataStoreService")
local catalogData = DDS:GetDataStore("catalogData")
local animationStore = {}
if data.nextPageCursor ~= nil then
while data.nextPageCursor ~= nil do
task.wait(0.2)
url = "https://catalog.roblox.com/v1/search/items/details?&Category=12&Subcategory=27SortType=0&SortAggregation=5&Limit=30&Cursor="..data.nextPageCursor
data = HttpProxy:GetAsync(url)
for key,value in pairs(data.data) do
pcall(function()
table.insert(animationStore, value.id)
local encode = catalogData:SetAsync(value.id,HttpService:JSONEncode(animationStore))
end)
end
end
end
if data.nextPageCursor == nil then
print("Done")
storedDataDecode = HttpService:JSONDecode(animationStore)
print(storedDataDecode)
end
I’m using a proxy, they’re just not included in that snippet of code. It’s not an issue with retrieving catalog ids, it’s just an issue with storing them.
Ah, my bad. Also, you have to decode the data before trying to use data.data I believe. (Unless you are already doing that). If that is not the problem, I’m not sure what else could be.
url = "https://catalog.roblox.com/v1/search/items/details?&Category=12&Subcategory=27SortType=0&SortAggregation=5&Limit=30&Cursor="..data.nextPageCursor
data = HttpProxy:GetAsync(url)
decodeData = HttpProxy:JSONDecode(data)
for key,value in pairs(decodeData.data) do
pcall(function()
table.insert(animationStore, value.id)
local encode = catalogData:SetAsync(value.id,HttpService:JSONEncode(animationStore))
end)
end
Which is returning an “attempt to call missing method ‘JSONDecode’ of table”. Which is an error I’ve never come across before, and after searching the error up on the devforum, nobody has actually reported it.
I switched it out for httpservice and it worked. However, it’s still returning the exact same output that I attached in the first post.
if data.nextPageCursor ~= nil then
while data.nextPageCursor ~= nil do
task.wait(0.2)
url = "https://catalog.roblox.com/v1/search/items/details?&Category=12&Subcategory=27SortType=0&SortAggregation=5&Limit=30&Cursor="..data.nextPageCursor
data = HttpProxy:GetAsync(url)
decodeData = HttpService:JSONDecode(data)
for key,value in pairs(decodeData) do
pcall(function()
table.insert(animationStore, data.value.id)
local encode = catalogData:SetAsync(data.value.id,HttpService:JSONEncode(animationStore))
end)
end
end
end
if data.nextPageCursor == nil then
print("Done")
storedDataDecode = HttpService:JSONDecode(animationStore)
print(storedDataDecode)
end
This is the output, keeping in mind it’s 3 sets because it’s searching 3 pages until there are none. (One after another). Based of this I assume it’s now a decoding issue?