How do I run a Simulation via the REST API and view simulated Job Runs via the REST API in AAI?
search cancel

How do I run a Simulation via the REST API and view simulated Job Runs via the REST API in AAI?


Article ID: 262796


Updated On:


Automation Analytics & Intelligence


How do I run a Simulation via the REST API and view simulated Job Runs via the REST API in AAI?


With the release of AAI 6.4.5-2, you can now run a Simulation and see Simulated job runs from the AAI REST API.


Release : 6.4.5-2


1. Access the AAI Swagger page by going to http://<ServerName>:8080/aai/devPreview


2. Authenticate using the POST /Authentication/login API call like below, click on the example on the right to copy over the template to the left, and click "Try it now".

Verify that you get a 200 return code after clicking "Try it Now".


3. Run the simulation from the API.

You are required to provide an Autosys v2 schedulerId, and a time for the simulation.

You can optionally enter any jil changes, global state exceptions, or job level exceptions.

The example below is specifying two job ID’s to be put on hold.

Sample POST /simulation/startWithServicePayload:


  "simulationTime": "2023/03/25 08:00:00",

  "simulationData": [


      "schedulerId": "AXxxxxxxxxx=",

      "jil" : "",

      "globalStateChange": [],

      "exceptionStateChange": [


          "jobId": "AYxxxxxxxxx=",

          "toState": "ON_HOLD"



          "jobId": "AZxxxxxxxxx=",

          "toState": "ON_HOLD"







  • The jobId’s can be retrieved from the GET jobs API call, or from the JawsJob table in the AAI database.
  • The schedulerId can be found using the GET schedulers API call or from the database:

select jobSchedulerId, schedulerName from JobScheduler;

After submitting the simulation, verify that you receive a 200 return code.


4. You will be able to see the progress on the Simulation web page:


Shortly after the simulation shows as completed on the simulation page, the jaws.log message below will display when the simulated runs will be available:

INFO  [SimulationRunner] Completed the JobStreamRunBuilder for simulation for AutoSys


You can verify that you see the purple simulated runs on a Monitoring tab view.


5. Getting simulated runs with GET /jobRuns/simulationRuns:


Required fields:

jobId’s - a comma separated list of jobId’s for jobs you want to monitor

fromTime - This should match a time frame within the simulation

toTime - The end time for which runs you want to see

(optional) maxSize, defaults to 100 results

To get the list of jobId’ you can use the queries below or use the GET /Jobs api call.

select jobSchedulerId, schedulerName from JobScheduler;


Use the schedulerId from the query above in the query below:

select jobId from JawsJob where jobSchedulerId='AZxxxxxxxxx=' and deletedTime is NULL;


Use a text editor to remove the page breaks and replace them with commas, so you have a comma separated list.  


Once you run the API call from the Swagger page it will give you a sample URL you can use in Postman or in a script, which will allow you to add a longer list of jobIds.

Sample URL:

On the Params tab it will show you the jobIds field, here you paste the full list of jobIds for the Autosys scheduler:

In postman you will also need to click on the Authorization tab and select Basic Authentication and enter an AAI user and password.

The default max results is 100, but this can be increased.


6. If you wanted to compare simulated job runs to Forecasted job runs during the same time period you can:

  • Use the Vision Forecasted Jobs panel in the web UI
  • Use the GET /jobRuns API call and specify the relativeFromTime and relativeToTime like belowFilter to just the Autosys scheduler with the string below in the search field: