How to execute different quota policies to multiple target endpoints?

quota 1 for target endpoint A, quota 2 for target endpoint B.Is it possible to execute based on the header value extracted ? @anilsagar

0 7 463
7 REPLIES 7

Hi @archana,

You can create different products for each target specific resources and implement different quota for each respective product.

Also you can create a custom attribute to categorise your products based on targets.

Similar question is answered here

That means i should create different proxies for each endpoint and add them to products?I could not use one proxy and use routing rules to direct the resources to different target endpoints? @Mohammed Zuber

@archana , Are you using route rules ? Are you using target servers ?

I am using route rules to different target endpoints

Hi @archana,

You can use route rules to target servers in the same proxy.

But for managing quota create different products like for example:

ResourcesQuotaTargetProduct
/users100T1P1
/users/{userid}100T1P1
/products200T2P2
/products/reviews250T2P3

Now to access the quota values at product level in your Quota Policy use flow variables from Verify API Key Policy(verify-api-key --> this is policy name) using below code.

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

Hope this helps!

Thanks

Added developer x to a product "abc"creating app "fb-app".The developer should see this product in his accounts with keys right ?Or we should have a developer portal to do that.Should i add him to my organisation with organisation roles. I followed all step defined in the doc to create app,product and developer.

I will explain in detail.I have api.facebook and api.twitter.So i created proxy named "sample"

to route to both these endpoints based on "route-to -header".Everything works as planned resources are redirected as per plan.Now facebook has a rate limit where every user of the facebook app can make 200 per hour and twitter have 15 min for 15min and 180 calls for 15 min window.

now for Facebook i have set quota for 200 calls for every access-token in query parameter .

now for twitter i have set quota for a group of resources some based on screen name and some application keys to each group representing different quota values.Am i making sense?How do i achieve this ? @Mohammed Zuber