Using Apinizer’s allowed hours policy, you are able to limit the hours a certain client can send access your API. This can be useful if you want your API to be accessible only during certain hours of the day (e.g when banks are open). To follow this tutorial, you should already have Apinizer installed and an API gateway defined.
For starters, go to your API’s gateway screen and click the “Add policy” button.
This will bring up a list of available policies. You’ll want to select “Allowed Hours” from that list. Once you do, another dialog will open to ask you if you want to create this policy as a local or global policy. Local policies are kept with that gateway and can only be applied to that gateway. Global policies on the other hand are kept separately from a gateway, and can be used across many gateways. For our example, we’re going to create a local policy.
Defining the Policy
Once you select the “Local Policy” option, Apinizer will need you to determine the intervals where access is allowed to your API. You can add as many intervals as you want through the big plus (
Example Image: Allowed hours for when most banks are open
After you add all the time intervals you need, you can save the policy and redeploy the gateway. You should now have a working allowed hours policy for your API.
Apinizer’s documentation also features a page detailing the Allowed Hours policy. You can find additional details about the policy at that page: