AE REST API - Working with Workflow Tasks

You can use the REST API to modify the status and some properties of tasks in Workflows as well as to take some actions on them while they are still running. As happens when working with running tasks in Workflows from AWI, the status of a task determines the actions that you can perform on that task also when doing it with the REST API. For more information, see Available Functions Depending on the Task Status.

This page includes the following:

Ignore the Task Sync Conditions

Request: POST http://{host}:{port}/ae/api/v1/{client}​/executions​/{run_id}​/ignore_sync_condition

Sync objects contain definitions on status, conditions and actions that are combined to specify the order in which tasks will be executed. Tasks can be in a waiting status due to these Sync definitions. You can use a POST request to ignore the conditions that have been specified in the Sync object that is assigned to the task. As a result, the task can start.

Example: http://my-jcp-host:8088/ae/api/v1/8001//executions/{run id}/ignore_sync_condition

Response: Depending on the status of the task and on the requested runID, the following responses are possible:

  • If the status of the task allows this action, the resulting status code is 200 OK and there is no response.

    {
        
    }
  • If the request contains an invalid runID or the runID corresponds to a task that runs in a different Client, the resulting status code is 404 Not Found and the response is a s follows:

    {
        "code": 11049,
        "error": ""Cannot find task with RunID('0001141003') for Ignore sync condition!",
        "details": "No detail information available."
    }
  • If the task is not active yet, the resulting status code is 403 Forbidden and the response is as follows:

    {
        "code": 11191,
        "error": "Task with RunID '0001168043' is not active.",
        "details": "No detail information available."
    }

Ignore the Task Preconditions

Request: POST http://{host}:{port}/ae/api/v1/{client}​/executions​/{run_id}​/ignore_preconditions

Tasks can be in a Waiting status due to specific pre-conditions defined for that task. You can use a POST request to ignore and skip these conditions for a task. As a result, the task continues executing.

Example: http://my-jcp-host:8088/ae/api/v1/8001/executions/1000535/ignore_preconditions

Response: Depending on the status of the task and on the requested runID, the following responses are possible:

  • If the status of the task allows this action, the resulting status code is 200 OK and there is no response.

  • If the request contains an invalid runID or the runID corresponds to a task that runs in a different Client, the resulting status code is 404 Not Found and the response is a s follows:

    {
        "code": 11049,
        "error": "Cannot find task with RunID('0001141003') for Ignore precondition!",
        "details": "No detail information available."
    }
  • If the request contains a runID that cannot be found or has already ended ok the resulting status code is 404 Not Found.

    {
        "code": 20591,
        "error": "Runtime error in object 'XSCRIPT' line '00001'. Object with RunID '0001004315' not found.",
        "details": "No detail information available."
    }
  • If the task is not active yet, the resulting status code is 403 Forbidden and the response is as follows:

    {
        "code": 11191,
        "error": "Task with RunID '0001168043' is not active.",
        "details": "No detail information available."
    }
  • If the task is not generated yet, the resulting status code is 403 Forbidden and the response is as follows:

    {
        "code": 4000056,
        "error": "Action not possible. Selected task is either not yet generated, or your monitor view needs to be refreshed (press F5).",
        "details": "No detail information available."
    }
  • If the status of the task does not allow this action, the resulting status code is 400 Bad Request and the response is as follows:

    {
        "code": 20532,
        "error": "IGNORE_PRE_CONDITIONS not possible for 'SCRI.OBJECT' (RunID '1000535') in state 'ENDED_NOT_OK'.",
        "details": "No detail information available."
    }

Modify Status Manually

Request: POST​/{client_id}​/executions​/{run_id}​/modify_status

You can use a POST request to manually modify the status of a task.

Important! Changing a status manually can have a negative impact in the whole processing. Please check regular ways of modifying a task status before resorting to this option. Also, this option should be restricted to very few users.

Example:

{
    "old_status": 1572,
   "new_status":1900
}

Response: Depending on the status of the task and on the requested runID, the following responses are possible:

  • If the status of the task allows this action, the resulting status code is 200 OK and there is no response.

  • If the request contains an invalid runID or the runID corresponds to a task that runs in a different Client, the resulting status code is 404 Not Found and the response is a s follows:

    {
        "code": 11049,
        "error": ""Cannot find task with RunID('0001141003') for Ignore precondition!",
        "details": "No detail information available."
    }
  • If an invalid state has been provided, the resulting status code is 400 Bad Request and the response is as follows:

    {
        "code": xxxxxx,
        "error": "Invalid state value (1300-2000): 6000",
        "details": "No detail information available."
    }
  • If the old status does not match, the resulting status code is 404 Bad Request and the response is as follows:

    {
        "code": 11140,
        "error": "The status of task '<task name>' has been modified meanwhile.",
        "details": "No detail information available."
    }

 

Modify Priority

Request: POST​/{client_id}​/executions​/{run_id}​/priority

This option is available for tasks with a status between 1500 and 1799 (see System Return Codes of Executable Objects). You can use a POST request to change the priority of a task.

Example:

 

Response: Depending on the status of the task, on the requested runID and on the requested priority range, the following responses are possible:

  • If the status of the task allows this action, the runID and priority range are correct, the resulting status code is 200 OK and there is no response.

  • If the requested priority is outside the allowed range, the resulting status code is 404 Bad Request and the response is as follows:

    {
        "code": xxxx,
        "error": "Priority out of range (0-255): 6000",
        "details": "No detail information available."
    }
  • c

    {
        "code": 11049,
        "error": ""Cannot find task with RunID('0001141003') for modify priority!"
        "details": "No detail information available."
    }
  • If the task has already finished, the resulting status codes are 403 Forbidden or 409 Conflict and the response is as follows:

    {
        "code": 4005774,
        "error": "Task with RunID '1168043' is not active or in a modifiable status.",
        "details": "No detail information available."
    }

See also: