Page 1 of 1

Update Predefined Collections using server script

Posted: Sun Feb 03, 2019 9:25 pm
by Vinny B

Hello

Code: Select all

I am trying to update the PREDEFINED COLLECTION DEVICES using SERVER CODE SCRIPT. 

The problem is I do not know how to access the predefined collections. I am running the code manually once and a while and I am not concerned about security) 

This is my current code.

//Name of the collection that you are targeting
var collection = "Devices";
var dbId = "5...";

var token = '5....';

var result = Collection.multiUpdateObject(dbId, collection, '{channels: "OLD"}', {"channels ":"NEW"});

Apperyio.response.success(result, "application/json");

This is my ERROR MESSAGE
Error code SCSE014: Script execution failed. Details have been added to Trace tab.


Update Predefined Collections using server script

Posted: Mon Feb 04, 2019 4:48 pm
by Serhii Kulibaba

Hello Vinny,

This collection is not available in the method "multiUpdateObject".

Please use a direct XHR2 request (https://docs.appery.io/v2.4.0/referen...)
to update devices. Here you can find an example of the request: https://docs.appery.io/reference#push...


Update Predefined Collections using server script

Posted: Mon Feb 04, 2019 5:36 pm
by Vinny B

That does not really help me. (im too much of a novice)

Is it possible to update multiple rows in the device database? im trying to add a channel to ALL the users without having to click a button 5000 times.

Vinny


Update Predefined Collections using server script

Posted: Tue Feb 05, 2019 6:24 pm
by Serhii Kulibaba

Could you please clarify what you have tried and what exactly does not work?

No, it is not possible to do for all of them by only one call. Please run the update service for all devices with a some custom code