Apigee Edge - 4MV4D - Quota Policy - Error Handling - Fault Variables - S02E11

Hello Apigeeks,

In this 4MV4D, Find out how you can customise out of the box quota related error messages in Apigee Edge by leveraging fault rules in Apigee Edge & fault variables set by Quota Policy when limits are reached.

For example, If a request comes from partner / developer you might want to send a custom error message with error code instead of Apigee Edge out of the box error message.

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 FaultRules & Assign message policy which sets custom error message below,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage name="set-quota-error-message">
    <AssignTo createNew="false" type="response"/>
    <Set>
        <Payload contentType="application/json" variablePrefix="@" variableSuffix="#">
        { "errorCode": "EQ001", "message": "QuotaExceeded"}
    </Payload>
    </Set>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</AssignMessage>

As you can see we are handling the Quota Violation error using fault rules & executing policies based on fault variable fault.name. You can leverage same concept to do actions like notifying some third party API / internal apps through APIs / alerting the stakeholder via email leveraging service callout policies.

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.

Version history
Last update:
‎03-09-2017 11:19 PM
Updated by: