Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Extract full RHS of URI Path into variable

Not applicable

Im using an Extract variables policy to get the path to add to a target endpoint. It only seems to work for one segment. How do I capture all the segments to the right?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" enabled="true" name="EV_GetPath" continueOnError="false">
    <DisplayName>ExtractVariablesGetPath</DisplayName>
    <URIPath name="name">
        <Pattern ignoreCase="true">/*/{targetPath}</Pattern>
    </URIPath>
   <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>


e.g. This works from http://domain/proxy/profile/a?foo=bar
targetPath = "/a"


But it doesnโ€™t work for http://domain/proxy/profile/a/b?foo=bar
targetPath =~ Unresolved variable : targetPath
 


How can I make it so thet {targetPath} captures everything from profile/ onwards?


So in the case above it would be: โ€œ/a/bโ€
Solved Solved
0 2 569
1 ACCEPTED SOLUTION

Not applicable

Decided that this was not possible using the ExtractVariables policy and so will revert to a javascript solution to extract the values I need using a regex. Shame.

View solution in original post

2 REPLIES 2