Using APIs to run workflows

Learn how to use webMethods Integration APIs to run a workflow.

Before you begin

  • To run a workflow by using webMethods Integration API, use an external service that can send HTTP requests.

  • Create a workflow and save it.

For example, you create a workflow that is named sample workflow that creates a board dev team status in your Trello account.

To run this workflow by using webMethods Integration API, follow the procedure:

Procedure

  1. Open a REST client and click Create New.
  2. On the REST client request page, click the Authorization tab. Set the Authorization type to API Key.
  3. Use X-INSTANCE-API-KEY as the Key name and provide the API key that is generated by using the SaaS Console as the Key Value. The HTTP client, pass the X-INSTANCE-API-KEY as an HTTP header and set the API key as its value.
    In this example, add the authentication details of the tenant that is associated with the sample workflow.

    For detailed steps on how to create API keys and Service IDs in the SaaS Console, see Granting access through service IDs and API keys from the IBM SaaS console.

  4. To run a workflow by using webMethods Integration API, the Workflow APIs-Execute section is referred.

    Perform a POST request at the URL of the workflow that you want to run. Use the URL syntax: <domain>/apis/v1/rest/projects/:project/workflows/:workflow/run

    In this URL syntax,

    • Domain is the tenant URL provided by webMethods Integration.
    • /: project is the name of the project that is associated with the workflow that you want to run, for example, Sample_Project.
    • /: workflow is the UID of the workflow that you want to run, for example, fla95fc030gfb181194bb363.
      Note: To retrieve the UID of the workflow, in webMethods Integration, browse the workflow that you want to run. Your tenant URL looks like this: .../#/projects/fl102d2ad2e4r7d78b1811ea/workflows/fla95fc030gfb181194bb363/edit. The UID of the workflow is the alphanumeric characters that appear after /workflows in the URL. Here, the UID of the workflow is fla95fc030gfb181194bb363
  5. Click Send to run the workflow.
    On successful execution, you can see the output in the REST client interface.
  6. Check the execution logs in the Workflow Execution screen on the Monitor page. You see that the workflow is run. You can click the name of the workflow to get the complete information on the performance of the workflow.
    When you check the workspace in your Trello account, you see a new board that is named dev team status, which is added to the list of existing boards.
    Note: You can save the API requests in the REST client collections for future use.