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
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, where you see a list of any existing REST APIs for that
project.
- Click Create API to go to the New API page
and select Create from scratch/Design new API and click
Next.
The
Basic Info page appears.
- 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.
Ensure 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}, its values
come from the workflow.
- Only workflows with a webhook and tested Auto connect Return Sync on Webhook
appear.
- You can also select the flow service instead of workflow. This 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. However,
if there is only one response code, it cannot be deleted.
- 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, ensure you 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.