In webMethods Integration, you can trigger project workflows or flow services through API endpoints by using
the REST APIs. You can build custom APIs or export existing ones, link them to your project
workflows or flow services, and make API requests to run those workflows or services remotely. The
Rest API builder feature works at the project level.
About this task
Explore the steps and learn how to create APIs in
webMethods Integration. Select one
of the following methods to create the REST APIs:
- Create from scratch/Design new API
- Import API/I have an existing API
- Import API using URL
Important: Your services must respond within 10 minutes to
external client invocations. If processing does not complete within this limit, the request is
automatically terminated and a timeout error is returned to the calling application.
If you
expect a process to run longer than 10 minutes, use an asynchronous messaging pattern instead of a
synchronous request-response invocation. Messaging decouples the client from the long-running
process, allows work to continue in the background while preventing timeout-related failures and
improving reliability and scalability. For more information, see Messaging.
Procedure
- Go to the project where you want to create an API and click the
APIs tab.
You are redirected to the REST
APIs page, which displays a list of all REST APIs available in the
project.
- Click Create API and on the New API page,
select Create from scratch/Design new API, then click
Next.
- On the Basic Info page, provide the following configuration details
for your API.
- A suitable name for the API you want to create in the Name field.
- A short description for the API in the Description field.
- A unique version number for the API in the Version field.
- Under Access network, select the networks from which the APIs can be
accessed. A dedicated URL to the API access endpoint is enabled for each selected network type. The
following access options are available.
- Public domain creates and configures an endpoint that allows access to
the API externally from the internet. This endpoint is listed under Public
URL on the API details page. Always require authentication for APIs
that are accessible from the public domain.
- Virtual Private Cloud (VPC) creates an endpoint that allows access
through an endpoint that is accessible only from an IBM webMethods network.
This endpoint is listed under Private URL on the API
details page.
- IwHI capabilities in this environment creates an endpoint that allows
access to the API only from other webMethods Hybrid Integration
capabilities, but not externally from the internet. This endpoint is listed under
Internal URL on the API details page. This option is
enabled by default and cannot be disabled.
When you select both the Public domain and Virtual Private
Cloud (VPC) options for a single API, webMethods Integration enables all
access endpoints for the API.
- Select the content type that the API can use in the Consumes
field. Currently, only application/json is supported.
- Select the content type that the API can produce in the Produces
field. Currently, only application/json is supported. Click
Save.
- Click Add Resource and add resources and methods to the API. Enter
the resource path by using allowed special characters (The maximum path length is limited to 2048
characters.). The API resource path supports these special characters:(_) Underscore, (-) Hyphen,
(.) Period, ($) Dollar sign, (!) Exclamation mark, (~) Tilde, (=) Equals sign, (:) Colon, (')
Apostrophe, or single quotation mark, (*) Asterisk, and (,) Comma. These characters are accepted.
Make sure that the resulting API URL complies with the standard API guidelines.
- Choose an HTTP method like POST, GET, PUT, DELETE, or PATCH, and add a short
description.
- Select a workflow or flow service to run with the API. Review the
Parameters section to see webhook payload keys and their sources, and add
descriptions. If the path includes parameters like
/postdata/{n1}/{n2} their values
come from the workflow.
- Only workflows with a webhook and tested Auto connect Return Sync on Webhook
appear.
- You can also select a flow service instead of a workflow. The following example describes steps
that use a workflow.
- After you select a workflow, enter the following details:
- In Parameters, provide the webhook payload keys along with
their sources that are associated with the selected workflow are listed in the
Parameters section. In the Description field,
optionally you can add a description for these keys.
For Workflows, if the path URL has
parameters in the format /postdata/{n1}/{n2}, the values of n1 and
n2 are derived from the workflow parameters.
- In Responses, enter response statuses for failed calls and add
more if needed.
You can update and delete the existing success response code. You cannot
delete a response code that is the only response code for an API.
- Click Done.
The
Resources and
Methods page is displayed.
You can select more than one HTTP method for a resource path
in an API. For example, to use the same resource path /sample for POST and GET HTTP methods.
- Click Save.
The API is successfully created.
Note:
- To enable the execution of an API from webMethods API Gateway, use the Internal URL
under the API Endpoints, which is displayed on the Rest API page.
- Support for domains with -internal is being deprecated soon. Reconfigure the
alias in webMethods API Gateway by using
the Internal URL provided under API Endpoints on the REST or SOAP
API details page.
- In an existing API, when you change the selected value for the Access
field from Private to Public or Public to Private, the changes take a while to propagate for the
ongoing API executions.
What to do next
Set up and enable REST APIs for your projects. First, you create a workflow that defines the
process. All workflows that you want to run through API endpoints must contain both
Webhook trigger and Auto connect Return Sync on Webhook
action in it. After configuration, you must test the Auto connect Return
Sync on Webhook action. Otherwise, the workflow does not appear in the list of
workflows available for execution through REST APIs. Use the API that is created to expose that
workflow. Finally, you run the workflow by using API calls. These steps help you connect and
automate your project tasks efficiently.