Extract Variable from URIPath with optional slash?

How do I do this without having to define the two patterns?

<ExtractVariables name="v_fetchLocationById">
    <URIPath name="name">
        <Pattern ignoreCase="true">/Locations/{masterLocationId}</Pattern>
        <Pattern ignoreCase="true">/Locations/{masterLocationId}/</Pattern>
    </URIPath>
    <VariablePrefix>subscriber</VariablePrefix>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>
Solved Solved
1 2 408
1 ACCEPTED SOLUTION

@jeffbrown ,

Welcome to Apigee Community 🙂

You can also use javascript policy & regular expressions to extract the variable from proxy path suffix. Ideally, Extract Variable policy with regular expression support should have been better to extract variables.

Unfortunately, Above mentioned solution in your question is the easy & quick way to solve the issue.

View solution in original post

2 REPLIES 2

@jeffbrown ,

Welcome to Apigee Community 🙂

You can also use javascript policy & regular expressions to extract the variable from proxy path suffix. Ideally, Extract Variable policy with regular expression support should have been better to extract variables.

Unfortunately, Above mentioned solution in your question is the easy & quick way to solve the issue.

Thank you! I may give the javascript solution a try, but it probably isn't worth spending too much time on it. More of an OCD "want to get it down to one line" thing than a necesity.