Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Contents

Table of Contents

...

Starting with version 2.5.5, SIL Engine™ exposes a REST service to facilitate arbitrary execution of SIL™ scripts. These services are available via HTTP POST at <your_base_url>/rest/keplerrominfo/refapp/latest/async-script and <your_base_url>/rest/keplerrominfo/refapp/latest/async. The service responses are all JSON formatted (see Beans below).

...

ParameterTypeRequiredDescription
dirPathstringyesThe path of the directory to scan. Can be absolute or relative to the silprograms folder. If absolute, it must still point to a location under silprograms.
regexstringyesThe regular expression to match the filenames against

Returns a 15482848 ScriptFileListResponse.


Code Block
languagejavascript
titleExample Request using AJS
AJS.$.ajax({
 type: 'POST',
 contentType: "application/json",
 url : "http://localhost:7210/rest/keplerrominfo/refapp/latest/async-script/findScriptFiles",
 data : JSON.stringify({
 	dirPath : "D:/test",
    regex : "[^.]*\.sil"
 }),
 success : function(data) {
	console.log(data);
 },
 beforeSend: function (xhr){ 
	 xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password)); 
 }
}); 



Code Block
languagejavascript
titleExample JSON Response
{
 "files":[
   "D:\\test\\test_1234567890 - Copy (5).sil",
   "D:\\test\\test_1234567890 - Copy (6).sil",
   "D:\\test\\test_1234567890 - Copy.sil",
   "D:\\test\\test_1234567890.sil"
 ]
}  


...

Schedules a check script task to be run asynchronously for the given script and returns a 15482848 ScriptScheduledResponse.

ParameterTypeRequiredDescription
source

15482848ScriptSource

yesThe script to check



Code Block
titleExample Request using AJS
AJS.$.ajax({
 type: 'POST',
 contentType: "application/json",
 url : "http://localhost:7210/rest/keplerrominfo/refapp/latest/async-script/checkScript",
 data : JSON.stringify({
   source : {
   	type: "INLINE",
   	code: "return 1;"
 	}
 }),
 success : function(data) {
    console.log(data);
 },
 beforeSend: function (xhr){
     xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password));
 }
});



Code Block
titleExample JSON Response
{
 "key" : 4
} 



...

Schedules a run script task to be run asynchronously for the given script and returns a 15482848 ScriptScheduledResponse. To run in the context of an issue, pass a property with the key "sil.issue.key" and value with the issue key.

ParameterTypeRequiredDescription
source

15482848ScriptSource

yesThe script to run
propertiesarray of objects containing "key" and "value"no


Code Block
titleexample properties
"properties": [
	{
		"key": "sil.issue.key",
		"value": "TEST-1"
	}
]


argsarray of stringsnowill be passed into the script as the "argv" variable

...

ParameterTypeRequiredDescription

source

15482848ScriptSource
yesThe script to run
propertiesarray of objects containing "key" and "value"no


Code Block
titleexample properties
"properties": [
	{	
		"key": "sil.issue.key",
		"value": "TEST-1"
	}
]


argsarray of stringsnowill be passed into the script as the "argv" variable

...

Checks if the task identified by the provided id is still running or has finished and returns an 15482848 AsyncResultResponse. If the task has finished execution, the result is removed from memory and returned in the response. Subsequent calls to this method will not return the result. If the task has not finished execution, you may repeat the call to getResult until the response contains "running": false.

...