Page tree

This section explains about the web service-related utilities that are part of BMC ProactiveNet Server installation. The following utilities are available when you install BMC ProactiveNet Server:

Note

You need Java Runtime Environment version 1.6 or above to run these utilities. The README.txt file located in the \pw\restclient folder explains the usage of the utilities.

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

  1. 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.
  2. On the command line, change the directory path to the following folder:
    \pw\restclient
  3. Set the class path by executing the following command based on your operating system:
    • (Microsoft Windows) setup.bat
    • (UNIX based) ./setup.sh
  4. Run the following command:

    java RestClient  callMethod "URL" userName password
    

Entry

Description

callMethod

Indicates the request method the API uses. The supported methods are as follows:

  • GET
  • POST
  • PUT
  • DELETE

URL

URL of the web service API enclosed within double quotation marks

userName

User name that you want to authenticate

password

Password for the corresponding user name

Example

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:

java RestClient -h

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:

(identifier1 operator1 "value1")
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.

Example

(name contains "CI230") AND (Description equals "New configuration item")

For more information about search APIs and their inputs parameters, see Searching CIs.

Note

The source files for the JSON creator utility are available in the \pw\restclient folder.

To run the JSON creator utility

  1. In the JsonInputForSearch.txt file, add the input parameters.
  2. On the command line, change the directory path to the following folder:
    \pw\restclient
  3. Set the class path by executing the following command:
    • (Microsoft Windows) setup.bat
    • (UNIX based) ./setup.sh
  4. Run the following command:

    java JsonCreator

    The 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
  • No labels