{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
0
Question by Vinodh · Dec 02, 2016 at 07:36 PM · 306 Views policies

Rate limit based on API Key and Query Param

Hi,

I was going through the documentation on rate limiting policy based on client apps, and found it a bit confusing.

Is there a way that I can specify a rate limit based on API key? For example, for API Key = 1, set a limit of 100 requests, for API key = 2, set a limit of 200, and so on?

Another question is, is it possible to control rate limits based on a query param? ie, we add a query param named "client". If client = A, set the rate limit as 100, if client = B, set the rate limit as 200 and so on.

Again, the current documentation did not really help.

Can anybody please help?

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

3 Answers

  • Sort: 
avatar image
1
Best Answer

Answer by Dino   · Mar 02, 2017 at 11:55 PM

You will use API Products to set the different quota limits.

Configure Product1 with quota limit 100

Configure Product2 with quota limit 200

Provision app1 onto Product1

Provision app2 onto Product2

Then use two policies, in this order:

  • a VerifyApiKey policy
  • a Quota policy that references the API-product specific quota limit. This limit is implicitly retrieved into the MessageContext by the VerifyApiKey.

The Quota uses an Identifier element. If you want, you can refer to a queryparam in that identifier. Usually the ID is the developer app id, or the client id. You can pass it in a header, or query param, or where-ever you like.

<Quota name="CheckQuota">
  <Identifier ref="request.queryparam.vinodh"/> 
  <Interval>1</Interval>
  <TimeUnit>hour</TimeUnit>
  <Allow count="200" countRef="verifyapikey.verify-api-key.apiproduct.developer.quota.limit"/>
</Quota>

See the documentation on the Quota policy for more information. There are screencasts explaining this.

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by gbhandari   · Dec 17, 2016 at 09:10 AM

Hi @Vinodh

Please go through the below link, I guess it might be helpful;,

https://community.apigee.com/questions/35553/is-it-possible-to-have-two-quota-policies-attached.html

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by vbalan · Feb 06 at 06:21 PM

Hi,

In order to make the quota policy work,

I had to add the proxy to the product,

also added a few additional fields to the Quota policy -

<Quota name="Quota-operation">
   <Identifier ref="request.queryparam.apikey" />
   <Interval ref="verifyapikey.Verify-API-Key-1.apiproduct.developer.quota.interval">1</Interval>
   <TimeUnit ref="verifyapikey.Verify-API-Key-1.apiproduct.developer.quota.timeunit">minute</TimeUnit>
   <Allow count="5" countRef="verifyapikey.Verify-API-Key-1.apiproduct.developer.quota.limit" />
   <Synchronous>true</Synchronous>
   <Distributed>true</Distributed>
</Quota>
Comment
Add comment Show 1 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image vbalan · Feb 06 at 06:22 PM 1
Link

Thank you @Sai Saran Vaidyanathan, @Dino

Follow this Question

Answers Answers and Comments

53 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Policy Guidelines for specific use cases 1 Answer

Cross-Origin Request Blocked 12 Answers

adding a policy to a deployed a127 project using management api 2 Answers

How to monitor every call that is raised from proxy? and How does rate limiting work for social apis? 1 Answer

How did I open this useful modal dialog box in the Apigee Edge "Develop" tab ? 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges