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 514
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

Not applicable

Hi,

proxy.url or request.url gives complete URL. For variable scope please go through below thread.

Please check http://docs.apigee.com/api-services/reference/variables-reference for complete variable reference .

You can find the information related to how to extract full URI path into variable here.

https://community.apigee.com/questions/24388/how-do-i-get-the-full-url-that-was-sent-by-the-cli.html

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.