Hello Apigeeks,
In this 4MV4D, Find out flow variables set by Quota Policy when API request goes through Quota Policy & How you can use same further down the line in different policies during the API runtime.
For example, If a request comes from partner / developer you might want to let them know how many API requests are consumed within the interval & how many are left. Take a look at 4MV4D below that explains same.
See Quota Policy used in this 4MV4D video below that shows Quota Policy in action,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Quota async="false" continueOnError="false" enabled="true" name="Quota-1"> <DisplayName>Quota-1</DisplayName> <Properties/> <Allow count="4"/> <Interval>1</Interval> <Distributed>true</Distributed> <Synchronous>true</Synchronous> <TimeUnit>minute</TimeUnit> </Quota>
See Assign Message policy used in this 4MV4D video below that shows how we are consuming the flow variables set by Quota Policy.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage name="set-dynamic-content"> <AssignTo createNew="false" type="response"/> <Set> <Payload contentType="application/json" variablePrefix="@" variableSuffix="#"> {"quotaAvailable":"@ratelimit.Quota-1.available.count#", "quotaUsed":"@ratelimit.Quota-1.used.count#"} </Payload> </Set> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> </AssignMessage>
As you can see we are sending back the quota available & quota used variables to the client in the response. You can leverage same concept to implement your requirement related to quota management / alter the API flow based on quota.
4MV4D videos are completely focussed on API Developers & Help you learn many interesting concepts very quickly using hands-on approach. Don't forget to subscribe to channel here & share same with your friends / colleagues who are interested in Apigee.
Feel free to send your feedback/queries using comments below or Ask a question if you have any query. Stay tuned for more videos.