Manage "script" classes
Execute a "script" class
Only users with Infrastructure-Manager role allowed
| name | type | description |
|---|---|---|
| asynch | form | if true, execute script asynchronously Possible values: true, false Optional default: false |
| destinationFolderId | form | id of the destination folder |
| file | form | multipart/form-data file parameter, with optional 'filename' and 'size' (see example below) |
| name | form | name of the script |
| writeResult | form | if true, write the result in the workspace Possible values: true, false Optional default: false |
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| media type | data type |
|---|---|
| multipart/form-data | (custom) |
| code | condition |
|---|---|
| 200 | Script correctly loaded. |
| 403 | You're not allowed to run scripts. |
| 500 | Error loading the script. |
| media type | data type | description |
|---|---|---|
| application/json | ScriptStatus (JSON) | outcome of the script execution |
POST /admin/script/execute
Content-Type: multipart/form-data
Accept: application/json
Authorization: ...
--------boundaryString
Content-Disposition: form-data; name="file"; filename="MoveFiles.class"; size=171018;
Content-Type: application/octet-stream
(binary data)
--------boundaryString
Content-Disposition: form-data; name="name"
MoveFile
--------boundaryString
Content-Disposition: form-data; name="async"
false
--------boundaryString
Content-Disposition: form-data; name="writeResult"
true
--------boundaryString
Content-Disposition: form-data; name="destinationFolderId="
5f4b3b4e-4b3b- ... -4b3b4e4b3b4e
--------boundaryString--
...
HTTP/1.1 200 OK
Content-Type: application/json
{
"status" : "Success",
"errorMessage" : "...",
"startDate" : "...",
"durationInMillis" : 12345,
"humanReadableDuration" : "...",
"result" : "...",
"runningId" : "...",
"executionServer" : "..."
}
Export the data
Only users with Infrastructure-Manager role allowed
| name | type | description |
|---|---|---|
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| code | condition |
|---|---|
| 200 | Script status retrieved. |
| 403 | You're not allowed to inquire script status. |
| 404 | Script not found. |
| media type | data type | description |
|---|---|---|
| application/json | ScriptStatus (JSON) | outcome of the export |
GET /admin/script/export
Content-Type: */*
Accept: application/json
Authorization: ...
...
HTTP/1.1 200 OK
Content-Type: application/json
{
"status" : "Failed",
"errorMessage" : "...",
"startDate" : "...",
"durationInMillis" : 12345,
"humanReadableDuration" : "...",
"result" : "...",
"runningId" : "...",
"executionServer" : "..."
}
Get the status of a script
Only users with Infrastructure-Manager role allowed
| name | type | description |
|---|---|---|
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| id | path | id of the script |
| code | condition |
|---|---|
| 200 | Script status retrieved. |
| 403 | You're not allowed to inquire script status. |
| 404 | Script not found. |
| media type | data type | description |
|---|---|---|
| application/json | ScriptStatus (JSON) | outcome of the script execution |
GET /admin/script/{id}/status
Content-Type: */*
Accept: application/json
Authorization: ...
...
HTTP/1.1 200 OK
Content-Type: application/json
{
"status" : "Success",
"errorMessage" : "...",
"startDate" : "...",
"durationInMillis" : 12345,
"humanReadableDuration" : "...",
"result" : "...",
"runningId" : "...",
"executionServer" : "..."
}