D4Science D4Science Don't have a D4Science account? Create one Could not find what you are looking for? Contact us.

ScriptManager Resource

Manage "script" classes

POST /admin/script/execute

Execute a "script" class
Only users with Infrastructure-Manager role allowed

Request Parameters
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
Request Body
media type data type
multipart/form-data (custom)
Response Codes
code condition
200 Script correctly loaded.
403 You're not allowed to run scripts.
500 Error loading the script.
Response Body
media type data type description
application/json ScriptStatus (JSON) outcome of the script execution

Example

Request
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--

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "status" : "Success",
  "errorMessage" : "...",
  "startDate" : "...",
  "durationInMillis" : 12345,
  "humanReadableDuration" : "...",
  "result" : "...",
  "runningId" : "...",
  "executionServer" : "..."
}
                
              

GET /admin/script/export

Export the data
Only users with Infrastructure-Manager role allowed

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Response Codes
code condition
200 Script status retrieved.
403 You're not allowed to inquire script status.
404 Script not found.
Response Body
media type data type description
application/json ScriptStatus (JSON) outcome of the export

Example

Request
GET /admin/script/export
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "status" : "Success",
  "errorMessage" : "...",
  "startDate" : "...",
  "durationInMillis" : 12345,
  "humanReadableDuration" : "...",
  "result" : "...",
  "runningId" : "...",
  "executionServer" : "..."
}
                
              

GET /admin/script/{id}/status

Get the status of a script
Only users with Infrastructure-Manager role allowed

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
id path id of the script
Response Codes
code condition
200 Script status retrieved.
403 You're not allowed to inquire script status.
404 Script not found.
Response Body
media type data type description
application/json ScriptStatus (JSON) outcome of the script execution

Example

Request
GET /admin/script/{id}/status
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "status" : "Success",
  "errorMessage" : "...",
  "startDate" : "...",
  "durationInMillis" : 12345,
  "humanReadableDuration" : "...",
  "result" : "...",
  "runningId" : "...",
  "executionServer" : "..."
}