Creating an HTTP-Client Custom Activity

You can create an activity based on a user-defined HTML client operation. The following procedure creates an activity based on an HTTP client request using Commvault REST APIs.


  1. From your Workflow window in the Activities pane, click Create Activity.
  2. In the New Activity Type dialog box, select HTTP Client from the Activity Type list and click OK.
  3. In the New HttpClient Activity dialog box, click the General tab and provide the following general details:
    • For the Name property, enter the name of the activity, for example, CreateUser. This is the name you will see in the Activities pane.
    • For the Description property, specify what the activity does.
    • For the Group property, select the activity group where you want to place the new activity, for example, Utilities. If you do not select a group, the new activity will be placed in the Ungrouped group.
  4. Click the Inputs tab to define the input variables that the activity will use.

    In our example, the CreateUser activity will need the following string variables to perform the query:

    • username,  the name of the user account to be created
    • password, the password for the user account
    • fullname, the full name of the user for whom the account is being created
    • email, the email account for the user account being created

    To add the inputs follow these steps:

    1. Click Add.
    2. In the Add new property dialog box, enter the name of the variable in the Variable Name box, for example, CreateUser.
    3. Select string from the Variable Type list and click OK.

    If applicable, you can specify a default value for the inputs in the Value column.

  5. Click the Definition tab to specify the details of the HTTP Client activity request. Select an HTTP method from the Method list. Click Preview to preview the action of the selected method.

  6. Click the Script tab to specify the Java or JavaScript code which this activity will perform.

    Following our example, the code will retrieve the output of the XML request. You can use this output perform any sort of data manipulation that you require.

    For example, using the REST API /SearchSvc/CVWebService.svc/Client the following Java code will validate the response and throw an error if the response is invalid:

    if (activity.getXmlResponse() == null || !activity.getXmlResponse().getName().equals("App_GetClientPropertiesResponse")) {
      logger.error("invalid http response recieved - " + activity.getXmlResponse());
      throw new Exception("invalid response");

  7. Click the Outputs tab to retrieve the output from the XML operation activity. You can set the xpath statements directly in the value of the output. Click OK.
  8. The new activity should be listed in the left pane under a specific activity group. You can drag the activity to the design area to start using it in your workflow.

Last modified: 2/25/2019 2:54:49 PM