AE REST API - Forecasting

Here you can find different examples of how to get and delete forecast data, trigger new forecast calculations as well as how to rename forecast items.

This page includes the following:

Get Forecast Items

Request: GET http://{host}:{port}/ae/api/v1/{client}/forecasts

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts

HTTP 200 Response:

{
    "total": 2,
    "data": [
        {
            "id": 1000001,
            "title": "AUTOFORECAST",
            "start_time": "2019-05-10T06:37:26Z",
            "end_time": "2019-05-10T06:37:26Z",
            "estimated_start": "2019-05-10T06:33:02Z",
            "estimated_end": "2019-05-20T00:00:00Z",
            "status": 1900,
            "status_text": "ENDED_OK - ended normally.",
            "user": "CD/CD",
            "type": "AFCST"
        },
        {
            "id": 1000002,
            "title": "SCRI1",
            "end_time": "2019-05-10T06:38:48Z",
            "estimated_start": "2019-05-10T06:38:00Z",
            "estimated_end": "2019-05-10T06:50:21Z",
            "status": 1900,
            "status_text": "ENDED_OK - ended normally.",
            "user": "CD/CD",
            "type": "FCST"
        }
    ],
    "hasmore": false
}

You can also use query parameters to limit your search to Forecast or AutoForecast only:

  • http://10.243.44.217:13850/ae/api/v1/100/forecasts?fc_type=AFCST
  • http://10.243.44.217:13850/ae/api/v1/100/forecasts?fc_type=FCST

Get Forecast Item Details

Request: GET http://{host}:{port}/ae/api/v1/{client}/forecasts?fc_type={type}&fields={fields}

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts?fc_type=AFCST&fields=entries

HTTP 200 Response:

{
    "total": 1,
    "data": [
        {
            "id": 1000001,
            "title": "AUTOFORECAST",
            "start_time": "2019-05-10T06:37:26Z",
            "end_time": "2019-05-10T06:37:26Z",
            "estimated_start": "2019-05-10T06:33:02Z",
            "estimated_end": "2019-05-20T00:00:00Z",
            "status": 1900,
            "status_text": "ENDED_OK - ended normally.",
            "user": "CD/CD",
            "entries": [
                {
                    "id": 1000002,
                    "parent": 0,
                    "name": "JSCH.SLOTS",
                    "type": "JSCH",
                    "estimated_start": "2019-05-10T06:33:02Z",
                    "estimated_end": "2019-05-11T00:00:00Z",
                    "estimated_runtime": 62818,
                    "status": 1900,
                    "status_text": "ENDED_OK - ended normally."
                },
                {
                    "id": 1000003,
                    "parent": 1000002,
                    "name": "JOBS1.1H30M",
                    "type": "JOBS",
                    "estimated_start": "2019-05-10T10:00:00Z",
                    "estimated_end": "2019-05-10T11:30:00Z",
                    "estimated_runtime": 5400,
                    "agent_destination": "WIN01",
                    "platform_destination": "WINDOWS",
                    "status": 1900,
                    "status_text": "ENDED_OK - ended normally.",
                    "login_destination": "LOGIN.WIN01"
                },
                {
                 ...
                },
                ...
           ]
        }
    ]
}

Rename Forecast Items

Request: POST http://{host}:{port}/ae/api/v1/{client}/forecasts/{FCID}

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts/1000002

HTTP 200 Response:

{
    "title": "SCRI_RENAMED"
}

Delete Forecast Items

Request: DELETE http://{host}:{port}/ae/api/v1/{client}/forecasts

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts

HTTP 200 Response:

The response contains the list of forecast IDs to be deleted.

{
    "ids": ["1000002", "1000002"]
}

Trigger Forecast and Autoforecast Calculation

You can trigger a new forecast calculation for objects, executions, and for a whole client (autoforecast). Different parameters are transferred for each forecast option. The response returns a forecast ID that identifies the forecast for further processing.

Object Forecast

This forecast option allows you to trigger the calculation for objects assigned either to a Job Group (see Job Group (JOBG)) or to an Agent Group (see Agent Groups (HOSTG)). The parameter ert_group_option specifies how you want the forecast to calculate its runtime. The default value is registration. The values allowed are the following:

  • registration: The forecast checks the calculation method specified for each object in the group or parent object. The ERT of the group is derived based on the ERT of the objects.

  • group: The ERT defined in the Group or parent object (Workflow or Schedule) and not the definitions in their child objects is considered for the runtime calculation.

  • fixed: Based on your experience with your objects and processes, you probably already know how long it takes to execute most of them. In this case you can indicate a specific value in seconds. The default value is 0 (zero).

Request: POST http://{host}:{port}/ae/api/v1/{client}/forecasts

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts

ert_group_option not defined

{
    "forecast_option": "object", 
    "object":    
        {        
            "name": "SCRI1",
            "start": "2015-04-15T06:37:59Z",
            "title": "SCRI1_TITLE"
        }
}

ert_group_option: group

{
    "forecast_option": "object", 
    "object":    
        {        
            "name": "SCRI1",
            "start": "2015-04-15T06:37:59Z",
            "title": "SCRI1_TITLE"
            "ert_group_option": "group"
        }
}

ert_group_option: registration

{     
     "forecast_option": "object", 
     "object":
        {
            "name": "SCRI1",
            "start": "2015-04-15T06:37:59Z",
            "title": "SCRI1_TITLE"
            "ert_group_option": "registration"
         }
}

ert_group_option: fixed

{ 
 "forecast_option": "object", 
 "object":
     {
         "name": "SCRI1",
            "start": "2015-04-15T06:37:59Z",
            "title": "SCRI1_TITLE"
            "ert_group_option": "fixed",
            "fixed": "120" 
         }
}

HTTP 200 Response:

{
    "forecast_id": "1000008"
}

Execution Forecast

This forecast option allows you to trigger the calculation for executions. The parameter days refers to the number of future days to use for the calculation. It considers all executions within the start of the execution plus the value defined in this parameter. The values allowed are 1 to 1000 days. If the value is set to 0 or to a value outside the valid range, the calculation fails.

Example

Days = 1 The forecast calculation includes the current day (now) until the end of the day (midnight).

Days = 14 The forecast calculation includes the current day (now) until the end of the 14th day (midnight).

Request: POST http://{host}:{port}/ae/api/v1/{client}/forecasts

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts

{
   "forecast_option": "execution", 
   "execution":
       {
           "run_id": "1004004",
           "title": "SCRI1_TITLE1",
           "days": "1"
       }
}

HTTP 200 Response:

{
    "forecast_id": "1000008"
}

AutoForecast

This forecast option allows you to trigger the calculation for a whole client. This option uses the value defined in the AUTO_FORECAST_DAYS parameter (see AUTO_FORECAST_DAYS) in the UC_CLIENT_SETTNGS variable. Therefore, no properties are passed in the response.

Request: POST http://{host}:{port}/ae/api/v1/{client}/forecasts

Example: http://10.243.44.217:13850/ae/api/v1/100/forecasts

{
   "forecast_option": "client"
}

See also: