...
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 |
Returns a ScriptFileListResponse.
Code Block |
---|
language | javascript |
---|
title | Example 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 |
---|
language | javascript |
---|
title | Example 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 ScriptScheduledResponse.
Parameter | Type | Required | Description |
---|
source | ScriptSource | yes | The script to check |
...
Schedules a run script task to be run asynchronously for the given script and returns a ScriptScheduledResponse.
Parameter | Type | Required | Description |
---|
source | ScriptSource
| yes | The script to run |
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: "FILE",
code: "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
} |
|
---|
...
Parameter | Type | Required | Description |
---|
source | ScriptSource
| yes | The script to run |
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: "INLINE",
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 |
---|
| HTTP 204 No content |
|
---|
...
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. If the task has not finished execution, you may repeat the call to getResult until the response contains "running": false.
Parameter | Type | Required | Description |
---|
key | int | yes | The unique key identifying a scheduled task. |
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" : [
{
"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
Anchor |
---|
| ScriptFileListResponse |
---|
| ScriptFileListResponse |
---|
|
ScriptFileListResponseField | Type | Description |
---|
files | string [] | List of absolute paths |
Anchor |
---|
| AsyncResultResponse |
---|
| AsyncResultResponse |
---|
|
AsyncResultResponse
Field | Type | Description |
---|
running | boolean | Signals that the script is still running and that you should wait a bit before retrying the call. |
outcome | Object | The results |
Anchor |
---|
| ScriptScheduledResponse |
---|
| ScriptScheduledResponse |
---|
|
ScriptScheduledResponseField | Type | Description |
---|
key | int | The unique key of the scheduled task |
...
Code Block |
---|
$curl -H "Content-Type: application/json" -u admin:admin -d " {\"source\" : { \"type\": \"INLINE\", \"code\": \"return 1;\"}}" 192.168.19.250:7210/rest/keplerrominfo/refapp/latest/async-script/runScript
{"key":43}
$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"]}} |
...