Automic Workload Automation

Expand all | Collapse all

execute workflow from outside Automic

Jump to Best Answer
  • 1.  execute workflow from outside Automic

    Posted 08-09-2018 08:30 AM

    Dear all,
    we want that some workflows could be started by business and therefore I am asking if it is possible to start Automic workflows from outside via REST service for example.

    If it is possible, is there any documentation how to set it up?

    Thanks in advance.

     

    best regards,

    Ben



  • 2.  Re: execute workflow from outside Automic

     
    Posted 08-09-2018 10:37 AM

    You can use the CALL API and JAVA API or the WebServices.

    Here the link to the documentation: Automic CallAPI and Automic WebServices

     

    Hope it helps



  • 3.  Re: execute workflow from outside Automic

    Posted 08-09-2018 11:33 AM

    We use the ExecuteObject Java API class.



  • 4.  Re: execute workflow from outside Automic

    Posted 08-13-2018 03:16 AM

    Thanks for your replys.

     

    meanwhile i was able to get it work with SoapUI and Postman.

     

    Does anyone know how to do it with CURL command?

     

    In Postman i can translate the the "rest" command to CURL (Invoke-WebRequest) command but its not working. Either Syntax issue or connection issue.

     

    curl -X POST http://VMXXXXX:XXXX/ae/api/v1/xxxx/executions -H 'authorization: Basic ******************************=' -H 'content-type: application/json' 

           -d '{

                  "object_name": "JOBP.WIN.EXAMPLE"
                }'

     

     

    The "authorization: Basic *********************************=" is Base64.
    For testing purpose i want to write USR/DPT/PWD in clear but i dont know exactly how.

    Anyone an idea?

     

    Thanks in advance.

     

    Best regards



  • 5.  Re: execute workflow from outside Automic
    Best Answer

    Posted 08-13-2018 06:27 AM

    Hi,

     

    i was able to get it work with powershell Invoke-RestMethod:

     

    $Auth = "Basic XXXXXXXX=" #Base 64
    $http = "http://XXXXXXX:XXXXX/ae/api/v1/XXXX/executions"
    $body = @{
    object_name = "JOBP.WIN.EXAMPLE"
    }


    Invoke-RestMethod -Method Post -Uri "$http" -Body (ConvertTo-Json $body) -Header @{"Authorization"=$Auth; "Content-Type" = "application/json"}

    Best regards.

    Ben



  • 6.  Re: execute workflow from outside Automic

    Posted 02-19-2019 03:57 AM

    Hi guys,

    i coming back to my "problem" months ago.

     

    Currently i want to start a workflow from outside Automic passing some Prompset variables to the RestMethod.

     

    my script:

     

    $user = "XX"
    $pass= "XX"
    $uri = "http://vXXXX:8088/ae/api/v1/1***/executions"

     

    $Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($user):$($pass)"))};

     

    $json =
    @{
    object_name ="JOBS.XX.XX"

    "ENVIRONMENT#" ="PRD"
    "EXEC_LOGLEVEL#" ="DEBUG"

    } | ConvertTo-Json


    Invoke-RestMethod -Uri $uri -Headers $headers -ContentType "application/json" -Method Post -Body $json

     

    Error message:

    Invoke-RestMethod : {
    "code" : 45106,
    "error" : "The request is invalid and cannot be processed by the Automation Engine.",
    "details" : "Unrecognized field \"EXEC_LOGLEVEL#\" (class com.automic.rest.executions.executeobject.InExecutionParameters), not marked as ignorable (3 known
    properties: \"inputs\", \"object_name\", \"execution_option\"])\n at [Source: org.eclipse.jetty.server.HttpInput@76ee87ea; line: 2, column: 25] (through reference
    chain: com.automic.rest.executions.executeobject.InExecutionParameters[\"EXEC_LOGLEVEL#\"])"
    }
    At line:21 char:1
    + Invoke-RestMethod -Uri $uri -Headers $headers -ContentType "applicati ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

     

    I want to start JOBS "JOBS.XX.XX with promptset varialbes ENVIRONMENT#=PRD and EXEC_LOGLEVEL#=DEBUG

     

     

    When i do it in Postman its working fine. Postman syntax:

     

     

    {
    "object_name": "JOBS.XX.XX",
    "inputs":
    {
    "ENVIRONMENT#":"PRD",
    "EXEC_LOGLEVEL#":"DEBUG"
    }
    }

     

    Anyone here who solved this using powershell Invoke-RestMethod ?

     

    Thanks in advance.

     

    Regards,

    Ben