Is it possible to access the url of a downloadable using cloud code?
At the start of our game, I would like to send an event request to update assets using downloadables.
Right now, we have: - A bunch of downloadables,
- Metacollection containing short codes + version id's of online downloadables. - Local collection containing short codes + version ids on player's device.
what I would like to have is an event where the player sends his local version ids, and gets a list of urls to download the new files in return.
(like the current request where you get the url of the downloadable, by giving the shortcode, but then in batch)
Right now, I use cloud code to return a list of shortcodes that need to be updated, after which I need to request every url + download the file.
Is it possible to ask the url of a downloadable using cloud code? That way we could almost halve the requests sent to GameSparks for the operation and thus minimize traffic a lot.
Best Answer
C
Customer Support
said
almost 8 years ago
Hi Fries,
To access a downloadable URL via cloud code you could create the following event:
var getDownloadableResponse = Spark.sendRequest({
"@class": ".GetDownloadableRequest",
"shortCode": "testDownloadable"
})
This does the standard downloadable request and stores the response in the getDownloadableResponse variable.
var downloadableURL = getDownloadableResponse.url;
Spark.setScriptData("DownloadableResponse", downloadableURL);
We can then use .url to extract the information from the response.
// array of all of all downloadables
var downloadables = Spark.getConfig().getDownloadables()
// return a single downloadable by shortCode
var downloadable = Spark.getConfig().getDownloadable("downloadableShortCode")
Fries Boury
Is it possible to access the url of a downloadable using cloud code?
At the start of our game, I would like to send an event request to update assets using downloadables.
Right now, we have:
- A bunch of downloadables,
- Metacollection containing short codes + version id's of online downloadables.
- Local collection containing short codes + version ids on player's device.
what I would like to have is an event where the player sends his local version ids, and gets a list of urls to download the new files in return.
(like the current request where you get the url of the downloadable, by giving the shortcode, but then in batch)
Right now, I use cloud code to return a list of shortcodes that need to be updated, after which I need to request every url + download the file.
Is it possible to ask the url of a downloadable using cloud code? That way we could almost halve the requests sent to GameSparks for the operation and thus minimize traffic a lot.
Hi Fries,
To access a downloadable URL via cloud code you could create the following event:
This does the standard downloadable request and stores the response in the getDownloadableResponse variable.
We can then use .url to extract the information from the response.
Oisin.
1 person has this question
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Fries,
To access a downloadable URL via cloud code you could create the following event:
This does the standard downloadable request and stores the response in the getDownloadableResponse variable.
We can then use .url to extract the information from the response.
Oisin.
Gordon McNaughton
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics