Hybrid Integration 10.4 | Integrating On-Premises Applications | Creating REST applications | Configuring a REST V2 Resource | Examples of Configuring REST Resources Using the URL Template-Based Approach
 
Examples of Configuring REST Resources Using the URL Template-Based Approach
A simple REST request looks like this:
METHOD /rad/namespace_of_rad/URL_template HTTP/1.1
Where...
Is the...
METHOD
HTTP request method.
rad
This is a directive which shows the type of processing to perform.
namespace_of_rad
The namespace of the REST API descriptor.
URL_template
The URL template to be used.
Consider the Discussion application described earlier in Configuring a REST Resource Using the Legacy Approach. Using the URL template-based approach, you can create a REST V2 resource named discussion under the app folder and define resource operations. The following examples show resource operations for the created resource and how Integration Server parses these requests:
Example 1
Consider a REST V2 resource operation configured with the following URL template:
/rad/app:discussionrad/discussion/topic/{id}
Here is an example request to display information about a specific topic:
GET /rad/app:discussionrad/discussion/topic/236 HTTP/1.1
Where...
Is the...
GET
HTTP method supported by the resource operation.
Note: Integration Server treats this method as valid only if the resource and the underlying service are configured to support the GET method. For more information about configuring supported HTTP methods for services, see webMethods Service Development Help.
rad/app:discussionrad
Template prefix. This informs the type of processing to perform, in this case, Integration Server REST processing, and fully qualified name of the rad element.
Note: For more information about directives, see
discussion/topic/236
The URL path based on the URL template where the path parameter id is substituted by 236.
Note: The id parameter must be available as a variable of type String in the input signature of the flow service associated with the resource operation for which you are defining the URL template. For more information about configuring a resource operation for a REST V2 resource, see webMethods Service Development Help.
Example 2
Consider a REST V2 resource operation configured with the following URL template:
/rad/app:discussionrad/discussion/topic/{id}/comment/{cid}
Here is a request to display information about a particular comment related to a topic, and how Integration Server parses the request:
GET /rad/app:discussionrad/discussion/topic/1591/comment/4 HTTP/1.1
Where...
Is the...
comment/4
Additional information for the topic with the identifier 1591. Integration Server matches this value with the portion of the request URL after the topic identifier. The value 4 is matched against the dynamic parameter {cid}.

Copyright © 2015- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.