...
Parameter | Type | Required | Description |
---|
dirPath | string | yes | The 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. |
regex | string | yes | The regular expression to match the filenames against |
...
Parameter | Type | Required | Description |
---|
source | ScriptSource | yes | The script to check |
Code Block |
---|
title | Example 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: "fileINLINE",
code: "return 1;"
}
}),
success : function(data) {
console.log(data);
},
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password));
}
}); |
|
Code Block |
---|
title | Example JSON Response |
---|
| {
"key" : 4
} |
|
---|
...
Code Block |
---|
title | Example Request using AJS |
---|
| AJS.$.ajax({
type: 'POST',
contentType: "application/json",
url : "http://localhost:7210/rest/keplerrominfo/refapp/latest/async-script/runScript",
data : JSON.stringify({
source: {
type: "fileFILE",
code: "return 1;example.sil"
}
}),
success : function(data) {
console.log(data);
},
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password));
}
}); |
|
Code Block |
---|
title | Example JSON Response |
---|
| {
"key" : 4
} |
|
---|
...
Code Block |
---|
title | Example Request using AJS |
---|
| AJS.$.ajax({
type: 'POST',
contentType: "application/json",
url : "http://localhost:7210/rest/keplerrominfo/refapp/latest/async-script/runDetachedScript",
data : JSON.stringify({
source: {
type: "fileINLINE",
code: "return 1;"
}
}),
success : function(data) {
console.log(data);
},
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password));
}
}); |
|
Code Block |
---|
title | Example JSON Response |
---|
| nullHTTP 204 No content |
|
---|
getResult
Checks if the task identified by the provided id is still running or has finished and returns an 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.
...
Code Block |
---|
title | Example Request using AJS |
---|
| AJS.$.ajax({
type: 'POST',
contentType: "application/json",
url : "http://localhost:7210/rest/keplerrominfo/refapp/latest/async/getResult",
data : JSON.stringify({
key: 4
}),
success : function(data) {
console.log(data);
},
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', "Basic " + btoa(username + ":" + password));
}
}); |
|
Code Block |
---|
title | Example JSON Response for checkScript |
---|
| {
"running":false,
"outcome": {
"valid": true
}
} |
Code Block |
---|
title | Example JSON Response for checkScript |
---|
| {
"running":false,
"outcome" : {
"errors" : {[
0 : {
"errLine":1
"error":"Encountered <DOUBLE> at line 1, column 13. Was expecting one of: ";" , "." , "." "
}
]
}
} |
Code Block |
---|
title | Example JSON Response for runScript |
---|
| {
"running":false,
"outcome" : {
"results":["string returned from script"] // array of values returned by script using "return val1, val2";
}
} |
|
---|
Beans
ScriptFileListResponse
...
Field | Type | Description |
---|
key | int | The unique key of the scheduled task |
ScriptSourceField | Type | Description |
---|
type | string | The type of the source. Either "INLINE" or "FILE". |
code | string | The source code If type is "INLINE", this should contain some SIL source code if type id "FILE", this should contain a path to a file. The path can either be absolute or relative to the silprograms folder. If absolute, must still point to a file under silprograms (e.g. "/opt/jira/home/silprograms/fld1/fld2/script.sil" and "fld1/fld2/script.sil" point to the same file) |
CURL Example
The following curl calls show how you would call SIL scripts from your favourite system (that's Linux, I hope). The commands assume that username / password is 'admin'
...
Code Block |
---|
$curl -H "Content-Type: application/json" -u admin:admin -d " {\"source\" : { \"type\": \"fileINLINE\", \"code\": \"return 1;\"}}" 192.168.19.250:7210/rest/keplerrominfo/refapp/latest/async-script/runScript
{"key":4}
$curl -H "Content-Type: application/json" -u admin:admin -d "{\"key\" : 3}" 192.168.19.250:7210/rest/keplerrominfo/refapp/latest/async/getResult
{"running":false,"outcome":{"results":["1"]}} |
...