Making a REST API call to ESP using a Python script.
search cancel

Making a REST API call to ESP using a Python script.

book

Article ID: 191060

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

Commands can be issued from distributed server(UNIX, Windows....) to ESP. The command can display current status of jobs, HOLD a job or most commands that can be issued in ESP.  There are many programming languages that are able to issue a REST API call. The example below is how to issue a command using Python. 

Environment

Release : 11.4 or greater

Component : ESP Workstation Server

Resolution

The ESP Workstation Server needs to have the WEBPORT enabled to received the command.  For more information on enabling the WEBPORT see the additional information. 
Below is a Python script to issue commands in ESP Workstation Server. 
******************************************************************************

import requests
from requests.auth import HTTPBasicAuth

data={
    "info":{
       "status":"req",
       "cont":"eom",
       "type":"command"
    }, 
    "data":{
       "request":"AJ DONJOB.TEST HOLD APPL(TEMPLATE.399"
    }

x = requests.post( 
    url = "http://CA11.lvn.broadcom.net:6167/command",
    auth=HTTPBasicAuth('POWDO03', 'CAW0rld'),
    json=data
)

print(x.text)

Additional Information

How to enable the WEBPORT can be found at the link below. 
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/reference/initialization-parameters/webport-specify-workstation-server-listening-port-for-web-services.html