0

I have created a rest service as:

<api xmlns="http://ws.apache.org/ns/synapse" name="GetCacheDataAPI" context="/GetCacheData/GetNotifications">
   <resource methods="GET" uri-template="?ID={searchValue}" inSequence="GetNotificationsIN" outSequence="GetNotificationsOUT"/>
</api>

in my InSequence GetNotificationsIN my payload is :

    <payloadFactory>
                <format>
                   <p:Cache xmlns:p="http://tempuri/Notification/">
                      <in xmlns="">
                         <xs:ID xmlns:xs="http://tempuri/Notification/">$1</xs:ID>
                         <xs:TagName xmlns:xs="http://tempuri/Notification/">$2</xs:TagName>
                         <xs:Category xmlns:xs="http://tempuri/Notification/">$3</xs:Category>
                         <xs:State xmlns:xs="http://tempuri/Notification/">$4</xs:State>
                         <xs:SourceID xmlns:xs="http://tempuri/Notification/">$5</xs:SourceID>
                      </in>
                   </p:Cache>
                </format>
                <args>
                   <arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
</args>
             </payloadFactory>

Now here i have passed a single parameter i.e. ID and is working fine. But the actual service on which i have implemented the rest service accepts five parameters which are ID, Tag, Source, State and Category. In the actual service i can pass any one parameter i.e. ID, Tag, Source, State or Priority and the service gives me data based on the parameter passed.

Simillarly i want to do exactly the same in my rest service i.e. in the uri template i want to implement these five parameter thus making five uri template variable which are saperated by a logical or so that if i hit the url of rest service with any uri template it should give me the response from the actual service. How can i do this? Thanks in advance

Community
  • 1
  • 1
Roy
  • 1,231
  • 1
  • 24
  • 61

1 Answers1

2

You can use url-mapping="/*" instead of uri-template, if there are number of queries. Check this post.

Ratha
  • 9,434
  • 17
  • 85
  • 163
  • Thanks for the reply Ratha, I have provided the payload. In that you can see there are 5 parameters of which the user can filter data based on any of the above parameter. Now suppose i want to get data based on source id will i hit the url in browser as :http://10.224.188.113:8281/GetCacheData/GetNotifications/SourceId ? – Roy Jun 21 '13 at 05:11