Handling 2 target paths in 1 proxy

Hi,

These is a case where backend URLs are 1. https://{Host}/abc/api/v1/dummy & 2.  https://{Host}/xyz/api/v1/dummy. 

for which i created APIGEE URL as https://{HOST}/{basePath}/(abc|xyz)/dummy

Though we can't have 2 URLs in 1 target,  tried it using Extract variable URI path as ,  to handle this. But the challenge is sometimes , i may get /something/anything after /dummy in  URL 2. for which i can n ot use extracted variables in dynamic target, because URl 1 may not have that extra path , if i use that variables in target it fails with undefined variables.

Please let me know if there is any way to do this.

 

Thanks

1 1 68
1 REPLY 1

@ChaitanyaVSK - In the Extract Variables, you can try something like this

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables continueOnError="false" enabled="true" name="EV-Path">
  <DisplayName>EV-Path</DisplayName>
  <Properties/>
  <URIPath>
    <Pattern ignoreCase="false">/{id}/**</Pattern>
  </URIPath>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <Source clearPayload="false">request</Source>
</ExtractVariables>

 So irrespective of what comes after the basepath, it will only consider the first path element and ignore the others. Try it out. Test fee scenarios and see how it works