Automic Workload Automation

 View Only

Expand all | Collapse all

Process to run /trigger post method rest api url without using rest service jobs in Automic

  • 1.  Process to run /trigger post method rest api url without using rest service jobs in Automic

    Posted Jan 02, 2025 11:04 AM

    Hi Team, 

    We trying to automate the alerting system in automic through rest API calls, as we have already tried the get methods call its working for us, is there any such a way to call the post method API calls through the browser or command, as for post method calls we need to provide data as JSON format and all.

    Please let us know if you are aware of such a thing, or if you have come across such a process with any written doc, please let us know about it.

    Thanks,

    Abhishek



  • 2.  RE: Process to run /trigger post method rest api url without using rest service jobs in Automic

    Posted Jan 06, 2025 03:50 AM

    Hi Abhishek

    Try Postman (software).

    Regards
    Joel



    ------------------------------
    ☎️ Swisscom Automation/AI Engineer & 🧙 PEM Creator

    Online Automic Training 24/7:
    https://membership.philippelmer.com/ (deutsch)
    https://pemautomic.com (english)
    ------------------------------



  • 3.  RE: Process to run /trigger post method rest api url without using rest service jobs in Automic

    Broadcom Employee
    Posted Jan 07, 2025 05:58 AM

    Hi @Abhishek Nayak

    if you want to call/use the AE's REST-endpoint you can use the command-line tool curl or PowerShell.

    Here is a sample of a PowerShell script that queries data from Rally. The variables Rally_Url, Rally_Token and Rally_Query are set by a PromptSet of the Windows-JOBS.

    function RallyQueryDefects( [Parameter(Mandatory=$true)][string] $URL, [Parameter(Mandatory=$true)][string] $APIKey, [Parameter(Mandatory=$true)][string] $Query)
    {
    $headers = @{
    "zsessionid" = $APIKey
    "Content-Type"="application/json"
    }
        $TotalResultCount = -1
     
        $QueryEncoded = [uri]::EscapeUriString( $Query)
     
     $URI = $URL + "/slm/webservice/v2.0/defect?query=" + $QueryEncoded.trim()
        try {
            [Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
            $rc = Invoke-RestMethod -Uri $URI -Headers $headers
     
            # Write-Host "rc:" $rc
            $TotalResultCount = $rc.QueryResult.TotalResultCount
            if ($TotalResultCount -eq 0) {
                Write-Host "URI:" $URI
                for ($i = 0; $i -lt $rc.QueryResult.Errors.Count; $i++) {
                    Write-Host "ERR: " $rc.QueryResult.Errors[$i]
                }
     
                for ($i = 0; $i -lt $rc.QueryResult.Warnings.Count; $i++) {
                    Write-Host "WRG:" $rc.QueryResult.Warnings[$i]
                }
     
        #    Write-Host "rc.QueryResult:" $rc.QueryResult
            }
        }
        catch {
            Write-Host "ERROR" $_
        }
     
        Write-Host "TotalResultCount=" $TotalResultCount
    }
     
    RallyQueryDefects &RALLY_URL# &RALLY_TOKEN# '&RALLY_QUERY#'

    Hope this helps

    Michael

     

     



    ------------------------------
    Michael K. Dolinek

    Engineering Program Manager | Agile Operation Division
    Broadcom Software
    ------------------------------