Hi I've created a simple Verify Api Key policy, and when I apply to a Pre-flow it works fine. But I would like to apply for a Flow. How can I do it?
<PreFlow name="PreFlow"> <Request> <Step> <Name>Verify-Api-Key</Name> </Step> </Request> <Response> </Response> </PreFlow>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <VerifyAPIKey async="false" continueOnError="false" enabled="true" name="Verify-Api-Key"> <DisplayName>Verify-Api-Key</DisplayName> <Properties/> <APIKey ref="request.header.x-api-key"/> </VerifyAPIKey>
I'd like to apply here:
<Flow name="put /v1/myresource/{Id}"> <Description>get resource by id</Description> <Request> <Step> <Name>Verify-Api-Key</Name> </Step> </Request> <Response/> <Condition>(proxy.pathsuffix MatchesPath "/v1/myresource/*") and (request.verb = "PUT")</Condition> </Flow>
Thanks for your help
Solved! Go to Solution.
Please refer the documentation , this has detailed explanation of using resource path.
This might help you in setting the proper condition for the flow to be started. W.r.t adding verify API key step you have coded absolutely correct.
Thanks
From the above code you have added the verify api key policy correctly .
However i hope you are calling the resource with the complete path and method (i.e in your case it would be https://xxxxx-test.apigee.net/apiname/v1/myresource/123 with request verb as PUT.
This would allow request to enter the condition flow you have created and ivoke verify api key policy.
Hope this helps
Cheers
Ateeb
I did a slightly change and it worked. I used the documentation bellow.
Please refer the documentation , this has detailed explanation of using resource path.
This might help you in setting the proper condition for the flow to be started. W.r.t adding verify API key step you have coded absolutely correct.
Thanks
What I did was the follow
<Flow name="get /v1/myresource/all">
<Description/>
<Request>
<Step>
<Name>Verify-Api-Key</Name>
</Step>
</Request>
<Response/>
<Condition>(proxy.pathsuffix MatchesPath "/myresource/all") and (request.verb = "GET")</Condition>
</Flow>
and I've created a new api product to access a Resource path: /myresource/all