How do I extract URI path element from the request?
The need is pretty obvious, and I am sure there is a way to do it - I am just not able to find the easiest way to do it on Apigee.
I have a URI say .../dogs/1234/owners
I need to extract '1234' to query for owners. How do I go about doing it on Apigee edge?
Solved! Go to Solution.
@Ritwik Chatterjee Try the extract variable policy. Here's one example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="ExtractVariablesStoreId"> <DisplayName>ExtractVariablesStoreId</DisplayName> <Properties/> <URIPath name="storeId"> <Pattern>**/stores/{storeId}</Pattern> </URIPath> <Source clearPayload="false">request</Source> <VariablePrefix>stores</VariablePrefix> </ExtractVariables>
So if your url has /search/stores/store123 then this policy would extract the store123 value in a variable called stores.storeId
@Ritwik Chatterjee Try the extract variable policy. Here's one example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="ExtractVariablesStoreId"> <DisplayName>ExtractVariablesStoreId</DisplayName> <Properties/> <URIPath name="storeId"> <Pattern>**/stores/{storeId}</Pattern> </URIPath> <Source clearPayload="false">request</Source> <VariablePrefix>stores</VariablePrefix> </ExtractVariables>
So if your url has /search/stores/store123 then this policy would extract the store123 value in a variable called stores.storeId
How to extract multiple variable from same url?
/store/{storeId}/location/{location}
You can find similar examples in the doc on ExtractVariables here.
Stephen
i want to use the javascript policy, can any one of you please guide me how to retrive with javascript policy
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |