A REST service provider exposes the resources in a process definition that can be invoked by clients using one of the following operations- POST, GET, PUT, PATCH, and DELETE.
Prerequisites
If a schema definition does not exist, create (or import) a schema definition in the process to which you want to add the REST service.
Procedure
-
In the Project Explorer, select the process to which you want to add the REST service. There are multiple ways to invoke the wizard to create a REST service.
- From the main menu, select
.
- Right-click the menu, select
.
- Click
Create REST Service in the process editor area. (Note that REST services can only be created in stateless BusinessWorks processes.)
![](GUID-1C772175-C8D4-4DAA-B40D-20E3142C4922-display.png)
For more information, see "REST Binding" in the
TIBCO ActiveMatrix BusinessWorks™ REST Reference guide.
-
In the
Create a New REST Service wizard, configure the REST service implementation by specifying the values for Resource Service Path, Type of Resource, Operations, and Implementation Data.
- Summary about the new REST service.
- Resource Service Path: Specifies the URI that is used to access the REST service.
- Type of Resource: Select if the service works on a single resource or a collection.
- Operations: By default, the GET operation is selected. Select or deselect the operations as needed.
- Resource Schema: Select a resource schema for the REST service, if needed.
- Implementation Data: Choose between structured and opaque implementation data.
-
Optionally, click
Next to configure the selected operations individually to specify the nickname for the operation (default nickname is of the format
<operation><resource_name>), summary, and the request and response elements and their data types.
-
Click
Finish.
The wizard adds the REST service and the selected operations, and also creates a process definition with the multiple operations.
Note: The REST service always implements the constructor operator.
-
Add activities to the process and configure them appropriately. For example, update the POST process to add a
Log activity to log the requests and connect the postOut activity to
Log activity.
-
Configure the input and output properties for the activities. For example, select postOut activity and then select
. Expand the data tree on the
Data Source tab and map the post element from the left to the post Response element on the right to echo the element. Similarly, for
Log activity, map the post element on the left to the ActivityInput message element on the right.
-
Save your changes.
Result
The REST service is built and can be tested using the built-in tester Swagger UI. For more information on Swagger UI, see "Testing the REST Service" in the
TIBCO ActiveMatrix BusinessWorks™ Getting Started guide.
Copyright © Cloud Software Group, Inc. All rights reserved.