Automic Workload Automation

 View Only
  • 1.  Creating a schedule via REST V12.3

    Posted Nov 27, 2019 04:50 AM
    I'm trying to replace in a Java application the UC4 resource adapter with REST calls (PoC with version 12.3).

    I am stuck with the problem of creating a schedule (JSCH) and assigning a workflow (JOBP) to it. Is this possible via REST (.../scripts service)?

    The current steps over the "AE Application Interface" are like:
     - CreateObject
     - AddScheduleTask
     - ScheduleTask
     - configure schedule (TimeZone, Period, CalendarCondition)
     - ExecuteObject

    ------------------------------
    IT Architect
    IBM Germany
    ------------------------------


  • 2.  RE: Creating a schedule via REST V12.3

    Posted Nov 27, 2019 09:35 AM
    The AE v12.3 REST APIs appear to lack four of the five required APIs. The only one that's available now is execution (POST), which can be used to execute an existing object. You could construct the schedule in XML and import it using object (POST), but I guess that's not really what you had in mind.


  • 3.  RE: Creating a schedule via REST V12.3

    Posted Nov 28, 2019 03:32 AM
    Hi there

    I'm very sure there will never be something like a "create object" endpoint since the objects can be built in JSON and then imported to the AE.

    Fun fact: if you remove a client on V12.3 using the REST-interface, it is using AE script to do so. Since there's a CallAPI replacement endpoint in 12.3, all AE-Script Features are now available.

    I'm on finalizing a PowerShell Core module (running on Linux, Mac, Windows) that supports almost all endpoints of AE V12.3 (there's also a V12.2 version out there). An additional module allows you to build workflows on the commandline. If you're interested see the attached readme's. They show the available commands and have usage examples. 

    Regards
    Joel

    ------------------------------
    Swisscom Automation Engineer & PE Membership Creator

    Entfessle mehr Automic Wissen mehr Automic Tools
    https://membership.philippelmer.com/
    ------------------------------

    Attachment(s)

    pdf
    README.pdf   221 KB 1 version
    pdf
    README_factory.pdf   204 KB 1 version


  • 4.  RE: Creating a schedule via REST V12.3
    Best Answer

    Broadcom Employee
    Posted Nov 28, 2019 01:10 PM
    HI Thomas,
    with the currently implementation of the v12.3  REST API you overwriting the JSCH, JOBP or anly other objects with a modified version of the object definition.
    Creating of objects working in the same way. Functions to modify specific properties do not exists.
    v12.3 has introduced a JSON format for the object definition. They JSON version could be retrieved with following REST call.

    get http(s)://<JCP Hostname>:8088/ae/api/v1/<client>/objects/<object name>
    content-typeapplication/json
    AuthorizationBasic <username> <password>

    Creating or modifying of an object
    post http(s)://<JCP Hostname>:8088/ae/api/v1/
    content-typeapplication/json
    AuthorizationBasic <username> <password>

    {
      "path""SYSTEM/SCHEDULES",
      "data": {
    ....
      }
    }

    The ExecuteObject REST function is very powerful and allows to schedule a Job in the future or periodically 
    post http(s)://<JCP Hostname>:8088/ae/api/v1/
    content-type: application/json
    Authorization: Basic <usename> <password>
    
    {
    	"object_name": "REST.PING.PROMPT.TEST.UNIX",
        "execution_option": "execute",
        "alias": "CALLED_BY_REST",
        "queue": "CLIENT_QUEUE",    
    	"inputs":
    	{
    		"TEXTFIELD1#": "passed text",
                    ....
    
    	}	
    }

    You find more examples how to schedule a Job in the REST help

    On request I could make an example available based on PowerShell which creates a Workflow with a number Jobs. The object definitions are provided in definition file.







    ------------------------------
    Sr. Solution Architect
    Broadcom
    ------------------------------



  • 5.  RE: Creating a schedule via REST V12.3

    Posted Nov 29, 2019 09:27 AM
    This is great news.  I am finding the new help article for rest api to be challenging to use.  I liked the swagger doc so much better, it was far more concise.

    Do you know if there is an easy way to get data back from an execution?  Specifically is there a way to see published or object values in a rest call?

    ------------------------------
    Scott Hughes
    Senior Automation Engineer
    Verizon
    Albuquerque, NM
    ------------------------------



  • 6.  RE: Creating a schedule via REST V12.3

    Broadcom Employee
    Posted Dec 04, 2019 07:44 AM
    HI Scott,
    you have to retrieve these information indirectly.
    Use the REST functions 'variables' and 'reports' to retrieve these information.
    The Automic runid get returned with the job execution.

    ------------------------------
    Sr. Solution Architect
    Broadcom
    ------------------------------



  • 7.  RE: Creating a schedule via REST V12.3

    Posted Dec 05, 2019 09:26 AM
    Hi Kay,

    I found that the rest api for executions gives me what I want, even better than UC Scripting :)

    http://[rest url]:8088/ae/api/v1/[client]/executions/[runid]/variables

    {
    "PC_NUM#": "0000000000000003",
    "PV_ACTION#": "remove_pool'",
    "PV_CMD#": "ansible-playbook --extra-vars \" -vvvv\"",
    "PV_FQDN#": "gch-internal-oci-ad1-west.verizon.com",
    "PV_INPUT_JDATA#": "{\"lb\": \"avi-oci-pr-phx-mgt\", \"env\": \"something\", \"fqdn\": \"something.com\", \"action\": \"remove_pool'\", \"ansible\": \"PROD\"}",
    "PV_JOB_STATE#": "Running",
    "PV_RESULT#": "<br>Starting new job ...<br>Starting task ...<br>Connecting to Ansible ...<br>Calling Ansible job -- <br>Status:<br>&nbsp;&nbsp; -- running <br>Status:<br>&nbsp;&nbsp; -- running",
    "PV_VZID#": "hughsc2",
    "PV_WF_RUNID#": "0004530075"
    }


    ------------------------------
    Scott Hughes
    Senior Automation Engineer
    Verizon
    Albuquerque, NM
    ------------------------------



  • 8.  RE: Creating a schedule via REST V12.3

    Posted Dec 04, 2019 08:14 AM
    Hi Kay,
    thanks for the information so far, I could create a schedule with your recommended procedure. But until now I've got error messages when I try to open the schedule in AWI (Inconsistency in database: 'OSA' for 'OH' not found. Key: '1052002'').
    So it would be great if you can make an example on Powershell - just to validate my approach. I can then "translate" it in our Java test application.

    ------------------------------
    IT Architect
    IBM Germany
    ------------------------------