REST API as an RMI batch file replacement
You use REST APIs instead of using Remote Method Invocation (RMI) batch files to work with the product. RMI is not supported in Maximo Manage.
RMI is a Java™ protocol that allows external applications to communicate with the product. You use REST APIs and configured API keys to communicate with the product through its REST client. The REST APIs offer similar features to those features that are available with RMI.
The following code sample shows a GET call to the viewQueueDataApi WebMethod in the MIC
AppService service. The URI for the AppService is
http://host:port/maximo/api/sevice/MIC.
Map<String,String> qp = new HashMap<String,String>();
qp.put("action", "wsmethod:viewQueueDataApi");
qp.put("count", ""+count);
if(selector != null)
{
qp.put("selector", ""+selector);
}
qp.put("queueName", ""+queueName);
byte[] data = new RestClient(serviceurl)
.withApiKey(System.getProperty("apikey"))
.withQueryParams(qp)
.invoke();
Similarly, you can make a POST call, as shown in the following code sample:
new RestClient(serviceurl)
.withApiKey(System.getProperty("apikey"))
.withQueryParams(qp)
.withMethod(RestClient.HTTPMETHOD_POST)
.invoke(data);//data is a byte[] - request payload
This type of call can be made with methods that are marked as WebMethods and are thus enabled for
REST API. You also can use similar code to call an object structure or combination of object
structures to get the correct placement for your job.