Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MethodArgumentsDescription
com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService
 execute a GET operation and return the result object
 urla URL that includes host and port of the web service, e.g.
http://localhost:44445/jobscheduler/agent/api/
com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand
 execute a configurable operation and return the result object
 operation

one of the HTTP verbs:

GET, POST, PUT, DELETE

 urla URL that includes host and port of the web service, e.g.
http://localhost:44445/jobscheduler/agent/api/
com.sos.jitl.restclient.JobSchedulerRestClient.getRestService
  retrieve the web service object
 
host

hostname or ip address of the web service, e.g.

localhost

 port

port for which the web service is accessible, e.g.

4445
 path

path and query string of the web service URL, e.g.

/jobscheduler/agent/api/

 protocol

protocol in use including http, https

com.sos.jitl.restclient.JobSchedulerRestClient.postRestService
host

hostname or ip address of the web service, e.g.

localhost

 port

port for which the web service is accessible, e.g.

4445
 path

path and query string of the web service URL, e.g.

/jobscheduler/agent/api/

 

Integration with JavaScript

  • Basically a web service call is implemented by executing one of the above methods from the JITL Java class:
    var response = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://localhost:44445/jobscheduler/agent/api/" );

    same as
    var response = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand("get", "http://localhost:44445/jobscheduler/agent/api/" );

     

     

  • The result object returned by the web service can be converted to a JavaScript JSON object by use of the eval() function:
    eval ( "var jsonObject = " + response + ";" );
     
  • Properties of the JSON object can be accessed with the object hierarchy as provided by the web service like this:
    jsonObject.system.hostname

Example

  • JavaScript sample example for use with a job: this job requests the status information from the JobScheduler Universal Agent and returns the total number of tasks that have been executed during the Agents' lifetime. This job reads the web service URL from a job parameter.
  • Download: rest_client.job.xml 
     

...