Quota

Use the Quota policy to configure the number of request messages that an app is allowed to submit to an API over the course of a second, minute, hour, or day.

Example

Use this sample code to enforce a quota of 1,000 calls. The policy starts and stops the counter based on the interval and unit of time of the time stamp for the first request message received by the API proxy.

For example, the first message is received at 2011-01-07 08:31:15. The quota counter starts at 2011-01-07 08:31:15 and the counter stops and resets to 0 at 2011-01-07 09:31:15 (1 hour from the start time). The start time is the clock or calendar start time of the defined TimeUnit value, such as second, minute, hour, or day. The end time is based on the elapsing of the Interval value in the defined TimeUnit.

If the counter reaches the 1,000-call quota before the end of the hour, calls beyond 1,000 are rejected.

Example:

<quota
    xmlns="http://www.infor.com/ion/api"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    name="quota-example" displayName="quota-example" enabled="true" version="1.0" >
        <userLevel>true</userLevel>
        <interval>1</interval>
        <timeUnit>hour</timeUnit>
        <allow>1000</allow>
</quota>

Configuration

Element name Default Presence Type Multiplicity
userLevel false Optional boolean 1
interval n/a Required integer 1
timeUnit n/a Required day, hour, minute, second 1
allow n/a Required integer 1

<quota> attributes

<quota name="quota-example" displayName="quota-example" enabled="true" version="1.0">
Field name Description Default Presence
name Name of this policy instance. N/A Required
displayName Optional
enabled Indicates if a policy is enforced or not. If set to false, a policy is turned off, and not enforced. true Optional
version Policy version. N/A Required

<interval> element

Use to specify the interval of time (in seconds, minutes, hours, or days as defined by TimeUnit) applicable to the quota.

For example, an Interval of 10 with a TimeUnit of hours means that the quota is calculated over period of 10 hours.

<interval>1</interval>

<timeUnit> element

Use to specify the unit of time applicable to the quota.

For example, an Interval of 10 with a TimeUnit of hours means that the quota is calculated over period of 10 hours.

The valid time units are: second, minute, hour, and day.

<timeUnit>hour</timeUnit>

<allow> element

Specifies a message count for the quota.

<allow>1000</allow>

<userLevel> element

This flag indicates if the quota should be set at the user level.

<userLevel>true</userLevel>