Cancel Request
Cancel a single running export request.
Use Case Description
- Identify request ID for request which has been submitted in error or should not be allowed to complete.
- Submit cancel action.
- Monitor status.
Export requests are, by definition, long running tasks. As such they are integrated with the Long Running Tasks (LRT) infrastructure and progress can be viewed or cancelled via the LRT management UI. See "Long Running Tasks" online help page for more details.
In addition to the LRT UI action, there is a REST API custom action available to cancel a running request. The action has no message body but still requires the use of the HTTP POST method. For this use case, assume that we have discovered that request ID 12345 has been submitted with incorrect filter criteria and so will produce incorrect data. It can be cancelled with the following cURL command:
curl -u username:password -X POST "https://servername.us2.oraclecloud.com/logisticsRestApi/data/v1/custom-actions/cancel/exportRequests/12345"
If the request is still running, this action will respond with an HTTP status of "200 OK" and temporarily mark the current progress of the request as "cancelling".
If the request has already completed, then the response will be an HTTP status of "400 Bad Request" with an error message saying that the given request was in an invalid state for a cancellation request.
An HTTP status of "404 Not Found" is returned if the request ID is not valid.
Check Status
curl -u username:password "https://servername.us2.oraclecloud.com/logisticsRestApi/data/v1/exportStatuses/12345"
{
"progress": "cancelling",
"startTime": {
"value": "2022-11-29T15:21:58Z"
},
"completed": false,
"result": {
"body": {
"requestID": 12345,
"submitDate": "2022-11-29T15:21:56Z",
"tables": {
"items": [
{
"itemID": 1,
"itemName": "SHIPMENT",
"startTime": "2022-11-29T15:21:58Z",
"endTime": "2022-11-29T15:22:17Z",
"progress": "succeeded",
"totalResults": 92,
"offset": 0,
"totalRecordCount": 92,
"parts": {
"count": 1,
"items": [
{
"partName": "DATA_12345_SHIPMENT_1_1.csv",
"recordCount": 92,
"checksum": "c9179dae8947cb56abaed4f6c2ea09b3"
}
]
}
},
{
"itemID": 2,
"itemName": "SHIPMENT_REFNUM",
"progress": "pending",
"parts": {
"count": 0,
"items": []
}
}
]
}
}
},
"links": [..etc..]
}
Any running request items will stop as soon as possible when this state is detected and mark their progress as "cancelled". Those that were already completed before cancellation was requested will remain in "succeeded" or "failed" state. At some time later, another status request should show:
curl -u username:password "https://servername.us2.oraclecloud.com/logisticsRestApi/data/v1/exportStatuses/12345"
{
"progress": "cancelled",
"startTime": {
"value": "2022-11-29T15:21:58Z"
},
"completed": true,
"result": {
"body": {
"requestID": 12345,
"submitDate": "2022-11-29T15:21:56Z",
"tables": {
"items": [
{
"itemID": 1,
"itemName": "SHIPMENT",
"startTime": "2022-11-29T15:21:58Z",
"endTime": "2022-11-29T15:22:17Z",
"progress": "succeeded",
"totalResults": 92,
"offset": 0,
"totalRecordCount": 92,
"parts": {
"count": 1,
"items": [
{
"partName": "DATA_12345_SHIPMENT_1_1.csv",
"recordCount": 92,
"checksum": "c9179dae8947cb56abaed4f6c2ea09b3"
}
]
}
},
{
"itemID": 2,
"itemName": "SHIPMENT_REFNUM",
"progress": "cancelled",
"parts": {
"count": 0,
"items": []
}
}
]
}
}
},
"links": [..etc..]
}