Skip to main content
Version: 5.7.0

RunScript

Executes a script on the server.

tip

Note that the data object will contain anything returned from the script.

tip

Pro-tip: If a script path is not specified in scriptName field, it will default to cloud code scripts root folder.

ServiceOperation
scriptRUN

Method Parameters

ParameterDescription
scriptNameThe name of the script with its absolute path to be run.
scriptDataData to be sent to the script in JSON format.

Usage

http://localhost:3000
string scriptName = "path/to/script1";
string scriptData = "{\"arg1\":42,\"arg2\":true,\"arg3\":\"example\"}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.ScriptService.RunScript(scriptName, scriptData, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"success": true
}
}
Common Error Code

Status Codes

CodeNameDescription
40363MISSING_SCRIPTThe script not found in specified folder.