Hybrid Integration 10.2 | Integrating On-Premises Applications | Creating REST applications | Configuring a REST Resource Using the URL Template-Based Approach | Examples of Configuring REST Resources Using the URL Template-Based Approach
 
Examples of Configuring REST Resources Using the URL Template-Based Approach
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 in a REST resource element called app under the discussionNode 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:
/restv2/app:discussionNode/discussion/topic/{id}
Here is an example request to display information about a specific topic:
GET /restv2/app:discussionNode/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.
restv2/app:discussionNode
Template prefix. This informs the type of processing to perform, in this case, Integration Server REST processing, and fully qualified name of the REST v2 element.
Note: For more information about directives, see webMethods Integration Server Administrator’s Guide.
discussion
Name of the resource on Integration Server.
topic
Name of the static part in the URL template.
236
Identifier for a topic. Integration Server matches this value against the dynamic parameter {id} specified in the URL template.
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:
/restv2/app:discussionNode/discussion/topic/t-{id}
Here is a request to display information about a topic based on its identifier and how Integration Server parses the request:
GET /restv2/app:discussionNode/discussion/topic/t-1591 HTTP/1.1
Where...
Is the...
t-1591
Identifier for a topic. In the URL template specified for this example, t is a static parameter while {id} is a dynamic parameter. Integration Server matches the value t-1591 against the topic identifier parameters specified in the URL template (t-{id}).
Note: In this example, Integration Server treats t-1591 as a valid value considering the URL template specified for the REST V2 resource operation. However, an identifier that does not follow the specified format, for example, 236 would be considered invalid.
Example 3
Consider a REST V2 resource operation configured with the following URL template:
/restv2/app:discussionNode/discussion/topic/t-{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 /restv2/app:discussionNode/discussion/topic/t-1591/comment/4 HTTP/1.1
Where...
Is the...
comment/4
Additional information for the topic with the identifier t-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- 2018 | 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.
Innovation Release