Creating a resource trigger

A resource trigger monitors for the creation, deletion, or updating of a specific resource and then initiates an action if its conditions are met. You can create a trigger using a curl command or by using the Swagger UI for the WebSphere Automation REST API.

About this task

You must have access to the WebSphere Automation REST API, and you must authenticate with Red Hat OpenShift Container Platform administrator credentials by clicking Authorize on the Swagger UI page.

Creating a resource trigger in WebSphere Automation

Use the Swagger user interface for the WebSphere Automation REST API to create a new action. The action resource is part of the Self-Secure API that are available in the Swagger UI at https://<cpd-route>/websphereauto/secvul/apis/openapi/ui/. For more information on finding the <cpd-route>, see Viewing the REST API.

On the Swagger UI page for Self-Secure API, do the following steps to create a trigger.

  1. Click Post /trigger to create a trigger.

    The section expands to show the Parameters tab, an example request body and schema, and responses.

  2. Click Schema to view the trigger schema.

    Make sure that you are familiar with the schema and the acceptable values for each parameter.

  3. Click Try it out.

    The request body area can now be edited.

  4. Modify the request body by changing the values in quotation marks after the colon for the parameters that you want to modify.

    For more information about the trigger resource parameters, see Trigger resource.

  5. Click Execute.
  6. Examine the response code.

    If your trigger is valid, the response code is 201 for a successful operation. Your trigger is active and ready to invoke the action with the specified actionId if the defined criteria are met.