search cancel

Autosys Rest API command using Curl?

book

Article ID: 253211

calendar_today

Updated On:

Products

CA Workload Automation AE

Issue/Introduction

Hi there, 

I have a quick question regarding AutoSys rest api.  
How do I go about getting the information below for job through Rest.


Environment

Autosys 12.x

Resolution

We do not have CURL examples for you.
You should be able to take the examples in the documentation and create a curl command.
Example 1:
example from the documentation:

 -- request --
GET https://WSServer:9443/AEWS/job/sleep1
 -- response --
200 OK
Server:  Apache-Coyote/1.1
Cache-Control:  private
Expires:  Wed, 31 Dec 1969 19:00:00 EST
Content-Type:  application/json
Transfer-Encoding:  chunked
Content-Encoding:  gzip
Vary:  Accept-Encoding
Date:  Wed, 01 Feb 2012 20:27:14 GMT
{"name":"sleep1","jobType":"CMD","machine":"WSServer","self":{"@rel":"self","@href":"https://WSServer:9443/AEWS/job/sleep1"},"status":"4"}

example curl command
curl -v -k --user "ejmcommander:ejmcommander" -X GET https://ghowa-centos08-autosys-full:9443/AEWS/job/mark1

example job definition that shows service desk configurations:
curl -v -k --user "ejmcommander:ejmcommander" -X GET https://ghowa-centos08-autosys-full:9443/AEWS/jil/job?name=mark1

* Server auth using Basic with user 'ejmcommander'
> GET /AEWS/jil/job?name=mark1 HTTP/1.1
> Host: ghowa-centos08-autosys-full:9443
> Authorization: Basic ZWptY29tbWFuZGVyOmVqbWNvbW1hbmRlcg==
> User-Agent: curl/7.61.1
> Accept: */*

< HTTP/1.1 200 
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Tue, 25 Oct 2022 19:19:21 GMT


/* ----------------- mark1 ----------------- */ 

insert_job: mark1   job_type: CMD 
command: echo 123
machine: ghowa-centos08-autosys-full
owner: [email protected]
permission: 
date_conditions: 0
std_out_file: "/tmp/$AUTO_JOB_NAME.$AUTORUN.out"
std_err_file: "/tmp/$AUTO_JOB_NAME.$AUTORUN.err"
alarm_if_fail: 1
alarm_if_terminated: 1
service_desk: 1
svcdesk_desc: "test"
svcdesk_pri: 5
svcdesk_imp: 4
svcdesk_sev: 4
* Connection #0 to host ghowa-centos08-autosys-full left intact

Example 2:
You can pull the job information using a filter on box name
example:
curl -v -k --user "ejmcommander:ejmcommander" -X GET https://ghowa-centos08-autosys-full:9443/AEWS/job?filter=boxname==Mark_Box


Sample response
{
    "job": [{
            "boxName": "Mark_Box",
            "name": "mark1",
            "jobType": "CMD",
            "machine": "ghowa-centos08-autosys-full",
            "self": {
                "@href": "https://ghowa-centos08-autosys-full:9443/AEWS/job/mark1",
                "@rel": "self"
            },
            "status": "4"
        }, {
            "boxName": "Mark_Box",
            "name": "mark2",
            "jobType": "CMD",
            "machine": "ghowa-centos08-autosys-full",
            "self": {
                "@href": "https://ghowa-centos08-autosys-full:9443/AEWS/job/mark2",
                "@rel": "self"
            },
            "status": "4"
        }, {
            "boxName": "Mark_Box",
            "name": "mark3",
            "jobType": "CMD",
            "machine": "ghowa-centos08-autosys-full",
            "self": {
                "@href": "https://ghowa-centos08-autosys-full:9443/AEWS/job/mark3",
                "@rel": "self"
            },
            "status": "4"
        }
    ],
    "self": {
        "@href": "https://ghowa-centos08-autosys-full:9443/AEWS/job?filter=boxname==Mark_Box",
        "@rel": "self"
    }
}

Example 3:

Below is an example of pulling a list of jobs that all have the service_desk field set to true or 1.

curl -v -k --user "ejmcommander:ejmcommander" -X GET https://ghowa-centos08-autosys-full:9443/AEWS/jil/job?name=ALL  | egrep "insert_job|service_desk: 1" | grep -B 1 "service_desk: 1" | grep insert_job | awk '{ print $2 }' | xargs -n 1 autorep -q -J

This same thing can be done with the autorep command as well.
autorep -J % -q | egrep "insert_job|service_desk: 1" | grep -B 1 "service_desk: 1" | grep insert_job | awk '{ print $2 }'| xargs -n 1 autorep -q -J

 

Additional Information

Please review the Autosys documentation on using web services:
https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/autosys-workload-automation/12-0-01/reference/ae-web-services.html

To get information about a job/box definition you would use the below call:
https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/autosys-workload-automation/12-0-01/reference/ae-web-services/manage-jobs.html#concept.dita_8cb4206f2f55b41de21ff673ae1441b79c4bdc2d_GETAEWSjobjobnamemethodRetrieveInformationofaSpecificJob

 

To review the job run information please use the below call:
https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/autosys-workload-automation/12-0-01/reference/ae-web-services/manage-jobs.html#concept.dita_8cb4206f2f55b41de21ff673ae1441b79c4bdc2d_GETAEWSjobruninfomethodRetrieveJobRunInformationofaSingleorMultipleJobs