ScheduleCloudScript
Schedules a scheduled cloud code job. Can be scheduled minutes from the current time or at a set time.
Note - brainCloud checks for schedule cloud code scripts every minute, so it is not recommended to run jobs that require only a 1-60 second delay.
Service | Operation |
---|---|
script | SCHEDULE_CLOUD_SCRIPT |
Method Parameters
Parameter | Description |
---|---|
scriptName | The name of the script with its path to be run. |
scriptData | Data to be sent to the script in JSON format. |
startDateUTC | If scheduling at a set time. The start date in UTC in Unix millis timestamp format. |
minutesFromNow | If scheduling in minutes from the current time. Number of minutes from now to run the script. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
var scriptName = "path/to/script1";
var scriptData = {
"parm": "value"
};
var startDateUTC = 1512750683157;
var minutesFromNow = 1;
var scriptProxy = bridge.getScriptServiceProxy();
var postResult = scriptProxy.scheduleCloudScript(scriptName, scriptData, startDateUTC, minutesFromNow);
if (postResult.status == 200) {
// Success!
}
{
"service": "script",
"operation": "SCHEDULE_CLOUD_SCRIPT",
"data": {
"scriptName": "path/to/script1",
"scriptData": {
"parm": "value"
},
"startDateUTC": "[[#ts+60000]]",
"minutesFromNow": 1
}
}
JSON Response
{
"packetId": 1,
"messageResponses": [
{
"status": 200,
"data": {
"result": {},
"scriptName": "testScript",
"jobId": "48266b95-d197-464d-bb6b-da70aa1e22a9",
"runState": "Scheduled",
"description": null,
"gameId": "10170",
"runEndTime": 0,
"parameters": {
"testParm1": 1
},
"runStartTime": 0,
"scheduledStartTime": 1437576422378
}
}
]
}