How to get the value of a query parameter received by tRESTRequest

Question

How do you configure a tRESTRequest component so that it can be called with the GET method with a query parameter, q=xxxxxxxxxx, in the URL, for example?

http://hostname : port/resource?q=xxxxxxxxxx

 

Answer

Configure the tRESTRequest component with a query parameter, by editing the schema, add a column (using any name), then set the Comment field to query.

queryType.jpg

 

Then you can get the value of this query, in this case "q", (for example, in a tJava or tJavaRow component), using the following code:

 

String q_value =

(String) ((Map<String, Map<String, List<String>>>)globalMap.get("restRequest")).get("ALL_QUERY_PARAMS").get("q").get(0);
Version history
Revision #:
3 of 3
Last update:
‎11-18-2019 07:02 AM
Updated by:
 
Contributors