Utilities for web services
This section explains about the web service-related utilities that are part of BMC TrueSight Infrastructure Management Server installation. The following utilities are available when you install BMC TrueSight Infrastructure Management Server:
Sample client for the web services
The sample client for web services helps you to run web service requests. The source files for the sample client are available in the \pw\restclient folder.
To run a web service request using the sample client
- For the web service APIs that use the POST or PUT method, create a file, input.txt, in the \pw\restclient folder and enter the input parameters.
- On the command line, change the directory path to the following folder:
\pw\restclient - Set the class path by executing the following command based on your operating system:
- (Microsoft Windows) setup.bat
- (UNIX based) ./setup.sh
Run the following command:
java RestClient callMethod "URL" userName password
For information about the java RestClient command, on the command line, change the directory path to the \pw\restclient folder, and run the following command:
JSON creator for CI search API (POST method)
This utility converts the input parameters to the JSON format. You can use these input parameters in the CI search API (POST method). In the JsonInputForSearch.txt located in the \pw\restclient folder, you must provide the input parameters in the following format:
groupingoperator (identifier2 operator2 "value2")
identifier refers to the slot name. You can retrieve a list of the searchable slots and the supported enumerations by accessing the usage API. See Retrieving searchable slots and supported enumerations for each slot.
value refers to the value of the slot. It must be provided within double quotation marks.
operator refers to the condition that relates the identifier and the value. The supported operators are listed in the OperatorsList.properties file located in the \pw\restclient folder. You must add any new operator in the file before using them in the JsonInputForSearch.txt file.
groupingoperator refers to the boolean operator. The supported values are AND and OR.
For more information about search APIs and their inputs parameters, see Searching CIs.
To run the JSON creator utility
- In the JsonInputForSearch.txt file, add the input parameters.
- On the command line, change the directory path to the following folder:
\pw\restclient - Set the class path by executing the following command:
- (Microsoft Windows) setup.bat
- (UNIX based) ./setup.sh
Run the following command:
java JsonCreatorThe inputs are converted to the JSON format and are available in the \pw\restclient\JsonOutputForSearch.json file. The converted output is as follows:
{
"criteria": {
"groupingOperator": "AND",
"leftExpression": {
"groupingOperator": null,
"leftExpression": null,
"rightExpression": null,
"operator": "contains",
"value": "CI230",
"identifier": "name"
},
"rightExpression": {
"groupingOperator": null,
"leftExpression": null,
"rightExpression": null,
"operator": "equals",
"value": "New configuration item",
"identifier": "Description"
},
"operator": null,
"value": null,
"identifier": null
}
}For information about the java JsonCreator command, on the command line, change the directory path to the \pw\restclientfolder, and run the following command:
java JsonCreator -h