REST API /executions returns less than expected number of objects
search cancel

REST API /executions returns less than expected number of objects

book

Article ID: 200149

calendar_today

Updated On: 09-30-2024

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation Automic SaaS

Issue/Introduction

When running the REST API /{client_id}/executions GET request, only a handful of executions (or none in some cases) are returned in the json Response when more are expected.

For example, for an object that has run 20 times so far, https://server:8088/ae/api/v1/0101/executions?name=AE_REST_API.GET_EXECUTIONS, the expected Response is:

2020-09-23 13:41:49             Response - application/json
2020-09-23 13:41:49             Start response pattern
2020-09-23 13:41:49             {
2020-09-23 13:41:49                 "total": 20,
2020-09-23 13:41:49                 "data": [
2020-09-23 13:41:49                     {
2020-09-23 13:41:49                         "name": "AE_REST_API.GET_EXECUTIONS",
2020-09-23 13:41:49                         "type": "JOBS",
2020-09-23 13:41:49                         "queue": "CLIENT_QUEUE",
2020-09-23 13:41:49                         "run_id": 1254530,
2020-09-23 13:41:49                         "status": 1550,
2020-09-23 13:41:49                         "status_text": "Active",
2020-09-23 13:41:49                         "activation_time": "2020-09-23T20:41:48Z",
2020-09-23 13:41:49                         "start_time": "2020-09-23T20:41:48Z",
2020-09-23 13:41:49                         "agent": "AGENT",
2020-09-23 13:41:49                         "platform": "CIT",
2020-09-23 13:41:49                         "parent": 0,
2020-09-23 13:41:49                         "user": "USER/DEP",
2020-09-23 13:41:49                         "estimated_runtime": 1,
2020-09-23 13:41:49                         "alias": "AE_REST_API.GET_EXECUTIONS"
2020-09-23 13:41:49                     },
...
2020-09-23 13:28:11                 ],
2020-09-23 13:28:11                 "hasmore": false
2020-09-23 13:28:11             }
2020-09-23 13:28:11             End response pattern
2020-09-23 13:28:11             Writing response output to file:C:\Automic\Automation.Platform\Agents\rapidautomation\RAREST003548\bin\task_reports\restResp_1254519.json
2020-09-23 13:28:11             RESTful job complete

The actual response has less than the actual amount (in this case only returning 1):

020-09-23 13:28:11             Response - application/json
2020-09-23 13:28:11             Start response pattern
2020-09-23 13:28:11             {
2020-09-23 13:28:11                 "total": 1,
2020-09-23 13:28:11                 "data": [
2020-09-23 13:28:11                     {
2020-09-23 13:28:11                         "name": "AE_REST_API.GET_EXECUTIONS",
2020-09-23 13:28:11                         "type": "JOBS",
2020-09-23 13:28:11                         "queue": "CLIENT_QUEUE",
2020-09-23 13:28:11                         "run_id": 1254519,
2020-09-23 13:28:11                         "status": 1550,
2020-09-23 13:28:11                         "status_text": "Active",
2020-09-23 13:28:11                         "activation_time": "2020-09-23T20:28:11Z",
2020-09-23 13:28:11                         "start_time": "2020-09-23T20:28:11Z",
2020-09-23 13:28:11                         "agent": "AGENT",
2020-09-23 13:28:11                         "platform": "CIT",
2020-09-23 13:28:11                         "parent": 0,
2020-09-23 13:28:11                         "user": "USER/DEPT",
2020-09-23 13:28:11                         "estimated_runtime": 1,
2020-09-23 13:28:11                         "alias": "AE_REST_API.GET_EXECUTIONS"
2020-09-23 13:28:11                     }
2020-09-23 13:28:11                 ],
2020-09-23 13:28:11                 "hasmore": false
2020-09-23 13:28:11             }
2020-09-23 13:28:11             End response pattern
2020-09-23 13:28:11             Writing response output to file:C:\Automic\Automation.Platform\Agents\rapidautomation\RAREST003548\bin\task_reports\restResp_1254519.json
2020-09-23 13:28:11             RESTful job complete

 

Cause

{client}/executions by itself includes only non-deactivated executions

Resolution

To include all executions of an object, use the query parameter "include_deactivated" with a value of "true".  This will include all executions of an object including deactivated objects.

The GET Request will look something like this:

2020-09-23 13:41:48             Request:GET http://server:8089/ae/api/v1/0101/executions?name=AE_REST_API.GET_EXECUTIONS&include_deactivated=true

Please note that this will by default only show 12 hours of results.  A time_frame_from parameter must be used to gather more than 12 hours.  

Additional Information

Documentation for this can be found in the REST API documentation for Executions