How to check job level agents without going application in Desktop Client?
search cancel

How to check job level agents without going application in Desktop Client?

book

Article ID: 447910

calendar_today

Updated On:

Products

ESP dSeries Workload Automation

Issue/Introduction

Users can use REST API to check for agents at job level for Unix and Windows jobs.

Environment

Workload Automation DE: 25.0 or above

Resolution

Create Personal Access Token (PAT) to connect and list jobs using any REST client (curl, Postman etc.).

1. Create a PAT in Desktop Client CLI.

2. Use command PATCREATE:

PATCREATE NAME("jobs-test") SCOPE("write") EXPIRY(10)

3. Give any name and expiry in days, maximum expiry 365 days, scope can be read / write.

4. Using any REST client, make the API call to list jobs.

Here is an example for curl.  I exported the PAT as TOKEN, you can put the whole token if you want.

curl -k --tls-max 1.3 -G "https://webui-server.example.com8443/de/api/v1/jobs" \
-H "content-type: application/json" \
-H "authorization: Bearer $TOKEN" \
-H "TLSSSLEnabledServer: true"

Make sure the webui-server and port are correct.  Use the hostname and port from the browser link, when you login to WebUI via browser.  Use "TLSSSLEnabledServer: true" only if DE server uses SSL to talk to clients.

To list all the jobs within an appplication, run this:

curl -k --tls-max 1.3 -G "https://webui-server.example.com:25443/de/api/v1/jobs" \
--data-urlencode 'query=applicationName=="SOME_APPLICATION"' \
  --data-urlencode 'size=200' \
  --data-urlencode 'offset=0' \
  -H "content-type: application/json" \
  -H "authorization: Bearer $TOKEN" \
  -H "TLSSSLEnabledServer: true" | jq '.records'

Note: The 'jq' is to beautify the JSON, it is not needed.  If jq is not available then use other methods like python3 -m json.tool etc.

Additional Information

For Windows, use Powershell to access jobs / application list via API:

curl -k --tls-max 1.3 -X GET "https://webui-server.example.com:25443/de/api/v1/jobs" `
-H "content-type: application/json" `
-H "authorization: Bearer $env:TOKEN" `
-H "TLSSSLEnabledServer: true" | ConvertFrom-Json | ConvertTo-Json

Note: Export Token as:

$env:TOKEN="E50BF6A............"