Sign In Register

How can we help you today?

Start a new topic



      It would be great to have a function to get more than one url. Example : I have 20 pictures of avatars in my downloadables and I want to have all urls with one call. Like SQL call with the "%" (ex : "avatar_%"), and you obtain all urls from downloadables with the shortcode that contain "avatar_"

1 Comment

Hey Guys,

You could create a custom log event request and give it a number attribute. When sent from the client, this number is the number of urls you want to get.
Then in the cloud-code for this event you can just loop through a GetUploadURL request for that count and push each url into a list you return in the script data.


var count = Spark.getData().count;
var urlList = [];
for(var i = 0; i < count; i++)
    var response = Spark.sendRequest({"@class": ".GetUploadUrlRequest"});
Spark.setScriptData('urlList', urlList);


 This should do the trick.
However, i'd be conservative about how many urls you are retrieving using this. Ive tested it up to 1000 and at 1000 is does take some time, but it didnt timeout, as i suspected it might. At 100, it was fine, so i'd keep it under that.


Login to post a comment