Conditional access control of Proxy Endpoint, based on day of week, time of day

Not applicable

Dear Team,

I am looking for solution of below situation:

1. I want to give access of my Proxy Endpoint from Monday to Friday for 9 AM to 5AM.

2. Per day request should not be more than 1000 request.

Is there any OOTB solution or policies provided by APIGEE for condition number 1 ? However second condition could be fulfilled by Quota policy.

If there is no OOTB policies, how could I achieve this functionality ?

Regards,

Shailendra Singh

1 2 341
2 REPLIES 2

@Shailendra Singh , Welcome to Apigee Community !

Absolutely, You can implement what you've described in Apigee Edge.

The flow variable "client.request.start.time" contains day, date, and time the request was received. You can extract day & time using extract variable policy & Use RaiseFault wrapped with a Condition to raise an exception.

I have done exactly same in a matter of minutes to validate Monday to Friday. You can extend the condition to validate the time also based on timezone with reference to UTC.

See attached proxy for a working example. mon-fri-api-rev5-2018-08-03.zip

Beyond client.request.start.time, There are other time-related variables that are available to you in the message context. For example, system.time.dayofweek gives you the number of the day of the week. Obviously that's another option for you to consider in the Condition. You can learn about all the variables in the variables reference.

Optionally, if your requirements are more complicated, you can leverage a Javascript or Java Policy to extract date time values into variables. But, the out of the box policies & variables I used in the example here should do the job for you.

Hope it helps. Keep us posted moving forward if any.

------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

Nice answer, super helpful, Anil!