API Connect

 View Only

 APIC Gateway Script adding additional query string parameters

Burak Görener's profile image
Burak Görener posted Tue February 25, 2025 11:41 AM

Hi All, 

I have to add a query string parameter before calling invoke. How can , handle it? 

I try to write sample script but it failed hence the original query strings are add end of the url as ../path?query=1?otherParam=1.

var queryParams = context.get('request.querystring');
var requestPath = context.get('request.path');
var newQuery = "query=1";
if (queryParams) {
          requestPath = requestPath + "?" +queryParams+ "&" + newQuery;
}else{
          requestPath = requestPath + "?" + newQuery;
}
context.set('overriden-path',requestPath);