Hi, My proxy base path is: /example/v1
My URI is : /example/v1/type
I need to extract the type how to give my pattern in extract variable policy.
My extract variable policy is:
<URIPath> <Pattern ignoreCase="true">/{type}</Pattern> </URIPath>
That looks pretty close to me. I've just done the same. Here's my example policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="ExtractType"> <DisplayName>ExtractType</DisplayName> <Properties/> <URIPath name="type"> <Pattern>/{type}</Pattern> </URIPath> </ExtractVariables>
Did it work?
Yes, it worked perfectly with the policy I posted above. I was able pull the type variable and apply it later by adding a new header with the AssignMessage policy.
But It doesn't works for me. Can you share your API Bundle
Have you checked it inside a flow. Inside the flow, it is not working.
Check in flow with where the condition is defined like
<Condition>(proxy.pathsuffix MatchesPath "/account/{id}") and (request.verb = "GET")</Condition>
The Extract variable policy on flow request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Variables-1"> <DisplayName>Extract Variables-1</DisplayName> <URIPath> <Pattern ignoreCase="true">/account/{id}</Pattern> </URIPath> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <Source clearPayload="false">request</Source> </ExtractVariables>
works fine.
Also please check the documentation. It has all details which may help you better
https://docs.apigee.com/api-services/reference/extract-variables-policy