Skip to main content

Cancel Instance Tasks

If it is necessary to cancel only one or more scheduled tasks without canceling the whole instance, you should use this endpoint for it. This enabled to send the instance and a list of tasks to be canceled.

Example:

The Strategy was designed to create some parallel flows like C2P (Contract to Partner), and the Seller Manager decided that the client doesn’t need to process this secondary flow, only the main flow that verifies the contract status and executes a recurring payment.

In that case, above we should use the instance cancel-tasks to continue with the instance active and cancel only the C2P tasks for that instance (contract).

InformationDataDescription
URL-Provided by boltPay squad
Endpoint/execution-instance/{instanceSid}/cancel-tasks?tasks={taskNames}instanceSid: Generated sid sent in the create instance response.
taskNames: the strategy task name identified sent as a list of strings separated by a comma: Ex: c2p-expiration,c2p-test-failed
MethodPOST-

Request

POST {url}/execution-instance/9ae5f1ff-8739-4fc6-a8d2-7643270b4a23/cancel-tasks?tasks=c2p-expiration,c2p-test-failed

Headers: { Content-Type: application/json, Strategy-Secret: asdxcv123asdzxcv, Authorization: Bearer asd123asdfd123.asdasd123.asda13213 }

Response

{
"executionInstance": {
"sid": "9ae5f1ff-8739-4fc6-a8d2-7643270b4a23",
"description": "Description example",
"status": "ACTIVE",
"updatedAt": "2024-05-29T14:27:23.899Z",
"createdAt": "2024-05-29T14:27:23.513Z"
},
"numCanceledEvents": 2
}