How to apply different quota for weekdays and weekends

Hi ,

Can anyone please suggest how to apply different quota for weekdays and weekends ?

lets say for weekdays I want to provide quota for 100 request for 5 days combined and for weekends want to give separate 100 request just for saturday and sunday combined.

Please suggest.

Solved Solved
0 2 370
1 ACCEPTED SOLUTION

There's no builtin way in Apigee to configure a quota that applies differently on Weekdays and Weekends. In other words there's no UI assistance for specifying "THIS quota applies to requests that are sent on Mon, Tue, Wed, Thu, or Fri, and THIS OTHER quota applies to requests sent on Sat or Sun".

But, with Conditions, the context variable system.time.dayofweek, and two distinct quota policies you should be able to do it.

Quota for weekdays:

<Quota name="Quota-Weekday" type="calendar">
   <Allow count="100"/>
   <Interval>5</Interval>
   <TimeUnit>days</TimeUnit>
   <StartTime>00:00:00</StartTime>
   <Identifier ref="verifyapikey.verify-api-key.client_id"/>
</Quota>

Quota for Weekends:

<Quota name="Quota-Weekend" type="calendar">
   <Allow count="100"/>
   <Interval>2</Interval>
   <TimeUnit>days</TimeUnit>
   <StartTime>00:00:00</StartTime>
   <Identifier ref="verifyapikey.verify-api-key.client_id"/>
</Quota>

And then in the flow you would enforce one or the other (not both) based on the value of system.time.dayofweek.

View solution in original post

2 REPLIES 2

There's no builtin way in Apigee to configure a quota that applies differently on Weekdays and Weekends. In other words there's no UI assistance for specifying "THIS quota applies to requests that are sent on Mon, Tue, Wed, Thu, or Fri, and THIS OTHER quota applies to requests sent on Sat or Sun".

But, with Conditions, the context variable system.time.dayofweek, and two distinct quota policies you should be able to do it.

Quota for weekdays:

<Quota name="Quota-Weekday" type="calendar">
   <Allow count="100"/>
   <Interval>5</Interval>
   <TimeUnit>days</TimeUnit>
   <StartTime>00:00:00</StartTime>
   <Identifier ref="verifyapikey.verify-api-key.client_id"/>
</Quota>

Quota for Weekends:

<Quota name="Quota-Weekend" type="calendar">
   <Allow count="100"/>
   <Interval>2</Interval>
   <TimeUnit>days</TimeUnit>
   <StartTime>00:00:00</StartTime>
   <Identifier ref="verifyapikey.verify-api-key.client_id"/>
</Quota>

And then in the flow you would enforce one or the other (not both) based on the value of system.time.dayofweek.

Thanks for the help 🙂