Skip to content

Commit

Permalink
Small changes to the scripts & processes (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVdV authored and benbosman committed Sep 10, 2019
1 parent 213cfaa commit 50adc78
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 62 deletions.
86 changes: 45 additions & 41 deletions processes-endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,65 @@ This endpoint will return a list of all created processes. The JSON response doc
"totalPages": 3,
"number": 0
},
"sort" : {
"by" : "script",
"order" : "asc"
},
"_embedded" : {
"processes" : [
{
"processId" : "000003f1-a850-49de-af03-997272d834c9",
"processId" : "1",
"userId" : "aa0263e2-b90a-4528-89fa-116ea4859de1",
"startTime" : "2017-11-22T10:29:11Z",
"status" : "RUNNING",
"endTime" : null,
"scriptName": "metadata-import",
"processStatus" : "RUNNING",
"parameters" : [
{
"name" : "c",
"name" : "-c",
"value" : "954e5cfa-6990-4c85-ae42-f30d8c7888e2"
},
{
"name" : "n",
"name" : "-n",
"value" : "true"
}
],
"_links" : {
"self" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9"
"href" : "/api/system/processes/1"
},
"script" : {
"href" : "/api/system/scripts/import"
},
"output" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/output"
"href" : "/api/system/processes/1/output"
},
"files" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files"
"href" : "/api/system/processes/1/files"
}
}
},
{
"processId" : "d3007ea8-1cc0-481d-914a-06720a200edf",
"processId" : "2",
"userId" : "c7d85e7f-63e5-4bc0-96cb-5d80be48d62e",
"startTime" : "2017-11-20T10:29:11Z",
"status" : "FAILED",
"endTime" : "2017-11-20T10:30:11Z",
"scriptName": "metadata-import",
"processStatus" : "FAILED",
"parameters" : [
{
"name" : "i",
"name" : "-i",
"value" : "c70893a6-ac55-48c7-9447-61e026b62929"
}
],
"_links" : {
"self" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9"
"href" : "/api/system/processes/2"
},
"script" : {
"href" : "/api/system/scripts/metadata-export"
},
"output" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/output"
"href" : "/api/system/processes/2/output"
},
"files" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files"
"href" : "/api/system/processes/2/files"
}
}
}
Expand All @@ -89,43 +89,41 @@ Optional parameters to query the processes:
* `status`: The status of the script
* `parameter.xyz`: Which parameters have been used, and their value

Sort options should support:
* `script`
* `startTime`

## Execution Details
**GET /api/system/processes/<:process-id>**

This endpoint will return details on the requested process.

```json
{
"processId" : "000003f1-a850-49de-af03-997272d834c9",
"processId" : "3",
"userId" : "aa0263e2-b90a-4528-89fa-116ea4859de1",
"startTime" : "2017-11-22T10:29:11Z",
"status" : "RUNNING",
"endTime" : null,
"scriptName": "metadata-import",
"processStatus" : "RUNNING",
"parameters" : [
{
"name" : "c",
"name" : "-c",
"value" : "954e5cfa-6990-4c85-ae42-f30d8c7888e2"
},
{
"name" : "n",
"name" : "-n",
"value" : "true"
}
],
"_links" : {
"self" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9"
"href" : "/api/system/processes/3"
},
"script" : {
"href" : "/api/system/scripts/import"
},
"output" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/output"
"href" : "/api/system/processes/3/output"
},
"files" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files"
"href" : "/api/system/processes/3/files"
}
}
}
Expand All @@ -146,16 +144,16 @@ This endpoint will let an administrator download an output file created by a pro

```json
{
"processId" : "000003f1-a850-49de-af03-997272d834c9",
"processId" : "4",
"_links" : {
"self" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files"
"href" : "/api/system/processes/4/files"
},
"mapfile" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files/mapfile"
"href" : "/api/system/processes/4/files/mapfile"
},
"zipfile" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/files/zipfile"
"href" : "/api/system/processes/4/files/zipfile"
}
}
}
Expand All @@ -172,9 +170,15 @@ Required parameters:
## Execution Deletion
**DELETE /api/system/processes/<:process-id>**

The will delete the process and associated files and output.
The will delete the process and associated files and output. Only processes with states of `SCHEDULED`, `COMPLETED` and `FAILED` can be deleted.

Support for stopping a process can be included in a future version.

Status codes:
* 201 Created - if the operation succeed
* 404 Not found - if the processes doesn't exist
* 422 Unprocessable Entity - If the process is running

Support for stopping a process can be included in a future version

### Script Invocation
**POST /api/system/scripts/<:script-name>/processes**
Expand All @@ -185,31 +189,31 @@ Delayed scripts using a `startTime` can be supported in a future version.

```json
{
"processId" : "000003f1-a850-49de-af03-997272d834c9",
"processId" : "5",
"userId" : "aa0263e2-b90a-4528-89fa-116ea4859de1",
"status" : "RUNNING",
"processStatus" : "RUNNING",
"parameters" : [
{
"name" : "c",
"name" : "-c",
"value" : "954e5cfa-6990-4c85-ae42-f30d8c7888e2"
},
{
"name" : "n",
"name" : "-n",
"value" : "true"
}
],
"_links" : {
"self" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9"
"href" : "/api/system/processes/5"
},
"script" : {
"href" : "/api/system/scripts/import"
},
"output" : {
"href" : "/api/system/processes/000003f1-a850-49de-af03-997272d834c9/output"
"href" : "/api/system/processes/5/output"
}
}
}
```

The possible `status` values are `RUNNING`, `COMPLETED` and `FAILED`.
The possible `status` values are `SCHEDULED`, `RUNNING`, `COMPLETED` and `FAILED`.
41 changes: 20 additions & 21 deletions scripts-endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DSpace has functionality to import and export items in CSV and ZIP format, to st
## Scripts Endpoint
**GET /api/system/scripts**

This endpoint will list all (REST supported) scripts defined in `dspace/config/launcher.xml`. The script entries are embedded with a name, description and a self link. By "REST supported" we mean all scripts that have been updated to allow invocations from the REST API.
This endpoint will list all (REST supported) scripts defined in `dspace/config/spring/rest/scripts.xml`. The script entries are embedded with a name, description and a self link. By "REST supported" we mean all scripts that have been updated to allow invocations from the REST API.

The JSON response document is as follows
```json
Expand All @@ -17,14 +17,11 @@ The JSON response document is as follows
"totalPages": 3,
"number": 0
},
"sort" : {
"by" : "name",
"order" : "asc"
},
"_embedded" : {
"scripts" : [
{
"name" : "import",
"type" : "script",
"description" : "Import items into DSpace",
"_links" : {
"self" : {
Expand All @@ -34,6 +31,7 @@ The JSON response document is as follows
},
{
"name" : "metadata-import",
"type" : "script",
"description" : "Import metadata after batch editing",
"_links" : {
"self" : {
Expand All @@ -58,80 +56,81 @@ The JSON response document is as follows
{
"name" : "import",
"description" : "Import items into DSpace",
"type" : "script",
"parameters" : [
{
"name" : "a",
"name" : "-a",
"description" : "add items to DSpace",
"type" : "boolean"
},
{
"name" : "b",
"name" : "-b",
"description" : "add items to DSpace via Biblio-Transformation-Engine (BTE)",
"type" : "boolean"
},
{
"name" : "c",
"name" : "-c",
"description" : "destination collection(s) database ID",
"type" : "id"
},
{
"name" : "d",
"name" : "-d",
"description" : "delete items listed in mapfile",
"type" : "file"
},
{
"name" : "e",
"name" : "-e",
"description" : "email of eperson doing importing",
"type" : "string"
},
{
"name" : "i",
"name" : "-i",
"description" : "input type in case of BTE import",
"type" : "string"
},
{
"name" : "n",
"name" : "-n",
"description" : "if sending submissions through the workflow, send notification emails",
"type" : "boolean"
},
{
"name" : "p",
"name" : "-p",
"description" : "apply template",
"type" : "string"
},
{
"name" : "q",
"name" : "-q",
"description" : "don't display metadata",
"type" : "boolean"
},
{
"name" : "m",
"name" : "-m",
"description" : "mapfile items in mapfile",
"type" : "file"
},
{
"name" : "r",
"name" : "-r",
"description" : "replace items in mapfile",
"type" : "boolean"
},
{
"name" : "R",
"name" : "-R",
"description" : "resume a failed import (add only)",
"type" : "boolean"
},
{
"name" : "t",
"name" : "-t",
"description" : "test run - do not actually import items",
"type" : "boolean"
},
{
"name" : "w",
"name" : "-w",
"description" : "send submission through collection's workflow",
"type" : "boolean"
},
{
"name" : "z",
"description" : "zip file containig the import",
"name" : "-z",
"description" : "zip file containing the import",
"type" : "file"
}
]
Expand Down

0 comments on commit 50adc78

Please sign in to comment.