How can I invoke a Rest Web Service having dynamic parameters?

07 Nov '17, 11:12 AM
12,807 Views
No Forum Badges

Hi all,

I'm trying to invoke a Rest Web Service in my Web Project .
This web service has different query string parameters that must be present in the endpoint URL only when necessary.
This is an example of a complete endpoint:

http://myrestwebservice.com/api/search/{object}?code=a&firstname=b&lastname=c

If {object} is "product" then I need to add the "code" parameter only.
For example:

http://myrestwebservice.com/api/search/product?code=a

If {object} is "employee" then I need to add the "firstname" and the "lastname" parameters.

I used the Restful Request Response operation for this purpose, but I'm not able to manage the query string parameters as desired.
How can I accomplish this?

 
x 0
Follow
Answer Answer at this question and get points!
Forum Expert - Level 8

Hi Laura,

the Restful Request Response operation does not allow to add and remove query string parameters at runtime.
In fact, if you declare all query string parameters, they will be always present in the URL, at least with an empty value.
So, what you need to do is to use a Script Component to compose the endpoint as desired and then pass it to the Restful Request Response operation.
You can find further information about how to use the Script Component reading this document:
https://my.webratio.com/learn/learningobject/using-the-script-component

   
x 0
Answer at this question and get points!

Related questions

Access wsdl in https Can not get generate and run option for DataService Project Cannot invoke method selectSingleNode() on null object Can't generate and run database or start tomcat server! CelsiusToFahrenheit Example com.webratio.rtx.RTXException: An error occurred dispatching the SOAP message Could not create service Custom Unit and AJAX / SOAP Description: Unknown tag 'wr:LinkResource' Exception REST Post request Exposing SOAP Web SERVICE on port different from 80 Generation options problem Getting started with Web Services How to change smtp port invoke rest web service that returns a pdf invoking a webservice using REST java.lang.NullPointerException No cloud accounts available No database on my cloud account Parameters order in a webservice request Problema generando la logica de un proyecto Problemas al invocar webservice Properties of the XSD Resource (File) Publish a web service publish web service for storing information in PostgreSQL DB following XSD Resource Sync DataService Project with Mobile Project usuarios y grupos WebRatio and MySQL WebRatio Mobile Platform Community edition - Restful request WebService DateTime value is not parsed to Date. Web service provider newline problem web service request using XSD Web service - Synchronize XSD When stars web ratio between dofollow and nofollow backlink has affected? When using web services, what kind authentication is used? which of these three models is closer to webratio/ifml way of creating web applications XML Out Unit and Soap Request Response Unit XML Schema Definition Support XML Schema Definition Support