how to dynamically change service callout url

Hi

I have a requirement where I need to change the Service CallOut URL based on some variable set in global org javascript resource

Example the below URL which is in Service CallOut policy

http://test.com:8080/{customVariable}/json/authenticate

Now this customVariable is set in Javascript Global Org Resource which needs to be replaced in above URL at run time

Any help would be highly appreciated

Thanks

Hi @GAURAV,

You have the answer in the question itself. As you have specified, within the service callout policy, you can specific a dynamic variable set into Apigee context enclosed within {}.

Ex: http://xyz-test.apigee.net/{dynamicVariable}

Two things to consider though from the doc here:

The protocol portion of the URL, http://, cannot be specified by a variable. Also, you must use separate variables for the domain portion of the URL and for the rest of the URL.

Stephen

1 Like