How to use default value in rest service query parameter?

Hi all,

I’m trying to virtualize the Google Places Autocomplete rest service on our Mediators (9.9) using Centrasite (9.9). No problem there, but I’d like to fill certain query parameters in the GET method with default values, so the (internal) consumers of the virtual rest service do not have to know (for instance) the access token for the Google api.
I created a rest service with a resource called autocomplete. I added a path parameter so the client has the choice between xml and json output.
I created a method GET with all the required and optional parameters. If the consumer fills out the required parameters, everything works. But, like I said, I don’t want them (to have) to know the token. So I entered the token as a default value for the parameter ‘key’ in the GET method. I thought that when the consumer omitted the required parameter ‘key’, it would be added and filled with the default value by the Mediator (automagically). No way. If the consumer does not specify the parameter ‘key’ with the right value, Google responds with REQUEST_DENIED.

The question is… How do I solve this? How do I define the rest service/resource/method to have the parameter ‘key’ added to the list of parameters filled with a value defined in Centrasite or the Mediator?

Thanks in advance,

Evert

Hi Evert,

You can implement an IS Service which will add the required query parameter and then configure “Invoke webMethods Integration Server” policy in the Request Handling section.

Regards,
Karthik G

Thanks Karthik,

However, this was not my preferred way to go. I am looking for a solution that doesn’t require coding (a flowservice) on a mediator. I’m also hesitant that invoking a flow service will add to much time to the processing.

Regards,

Evert

B.T.W. We already solved this because our (internal) customer, our SAP devs, had to use their backend (SAP RFC call) to use this API and therefor we switched to our integration server where I could add the default value. Of course this is slower than pure mediation, but in this case we had no choice.

Hi Evert,

webMethods API Gateway is the new product which combines the Enterprise Gateway and Mediator capabilities.

With the API Gateway 10.3 you can use the ‘Request transformation’ policy which allows to add a query parameter to be sent to the native service.

But you would need to upgrade the CentraSite version to 10.1 or 10.3(recommended) to be able to publish the APIs from CentraSite to API Gateway.

Regards,
Karthik G