Sign In Register

How can we help you today?

Start a new topic

Search downloadables colleciton via REST api or cloud code

Hello,


We have quite a few asset bundles and images in the "Downloadables" section of our game, and were wondering if there is a way to perform queries on this collection.  Similar to the way you can interact with NoSQL collections via cloud code. Our goal is to get the count of items containing a certain string parameter in the short code.  A simple JSON array with shortcodes and filenames would be great, if possible.


Thanks,


Alex


Hi Alex,


There isn't a collection for Downloadables so you can't query it like a normal collection but you can get an array of them back using SparkConfig, you can read more about it here. So something like the following will work for you.


 

//array of all of all downloadables
var downloadables = Spark.getConfig().getDownloadables()


//return a single downloadable by shortCode
var downloadable = Spark.getConfig().getDownloadable("downloadableShortCode")

 

Let me know if that helps,


Thanks,

Liam

That worked, thanks!


Alex

Login to post a comment