Invoking a REST service
- Watson services: For more information about Watson APIs, see Watson API Explorer.
- IBM® Operational Decision Manager business rules: For more information about using business rules, see Using IBM ODM business rules.
- Hyperledger Composer services:
- For more information about using Hyperledger Composer, see Build Blockchain applications and business networks your way.
- For a developerWorks tutorial that explains how to integrate an external blockchain service in a business process, see Combine business process management and blockchain.
Before you begin
About this task
To use a REST service in Process Designer, you discover the service and select the operations that you want to use. Then, set the server that contains the configuration properties that are required to invoke the service. An external service is generated containing the operations that you selected in the discovered service and a reference to the server that you selected. Business objects are also generated based on the OpenAPI specification.
Service providers update their services periodically, and you might want to rediscover the updated service so that you can use it. When you discover a service, if an external service discovered from the same file already exists in Process Designer, you can either overwrite the existing service or create a new one. To get the updated version of the REST service, replace the external service. If you have a service task for the external service, their operations and data mappings are preserved, unless the operation or data is not included in the new version. If the server connection information is unchanged, you can keep the reference to the server information.
Procedure
To discover an existing REST service with an OpenAPI specification and generate an external service that you can use in a service flow, complete the following steps.
Results
- In the Details section, the service name and its documentation is shown.
- Selecting Binding shows the binding type of REST and the server. If your server binding properties change, you can select a different server.
- Selecting Source shows the OpenAPI specification source in read-only mode. This is useful for viewing the operations that you want to invoke using JavaScript API.
- In the Data library section, you might see business objects as a result of generating the REST API service. These business objects are only for the external service and are read-only. Deleting the external service also deletes these business objects.
After your service is created, you can select it as an implementation of a service task in a service flow. Select the operation that you want to use from the operation list and map the inputs and outputs in the Data Mapping tab. If you are using JavaScript to invoke your operation, enter your JavaScript in a script task in a service flow. See Creating a service flow and Invoking a REST service by using JavaScript.
To catch any errors that might occur in the service, attach a catch all boundary error event to it, as described in Catching errors by using error boundary events.