UCMDB Java API - Quick Start Tips

  • KM03249776
  • 19-Sep-2018
  • 19-Oct-2020

Summary

This article provides a quick startup towards familiarisation with the Java API

Question

The suggestion below advises a quick way of becoming familiar with the UCMDB Java API. 

A knowledge of Java is assumed.

It is also assumed that Java is installed (a higher version than Java 6) and that the path and JAVA_HOME are defined.

Answer

1) Download the Jar from the "API Client Download" link provided in the UCMDB GUI and placed it in a convenient place on your hard drive


2) Create an integration user by following the steps in the developers guide entitled - “Create an Integration User” 


3) Copy some of the samples in "C:\hp\UCMDB\UCMDBServer\deploy\ucmdb-docs\docs\eng\APIs\JavaSDK_Samples" to the directory where you saved the API jar in step 1). Suggested are :-  CreateSDKConnectionSample.java, QueryHistorySample.java and QueryClassModelSample.java 

4) In CreateSDKConnectionSample.java add the requested details including the user set up in 2)


5) Compile ( using a command prompt pointing to the directory to where you saved the API jar in step 1). 

javac -cp .;ucmdb-api.jar CreateSDKConnectionSample.java

javac -cp .;ucmdb-api.jar QueryClassModelSample.java

javac -cp .;ucmdb-api.jar QueryHistorySample.java


6) And then run these two sample queries to see the outputs (both these classes call CreateSDKConnectionSample to connect to the UCMDB Server)

  java -cp .;ucmdb-api.jar QueryClassModelSample 
  java -cp .;ucmdb-api.jar QueryHistorySample
 


Obviously in your custom application you will be using your own custom code and a proper development tool , however the above steps should be a start.