How to set quota limit with different target endpoint

Hi Community google

i try to explore apigee which is quota limit, here the question

1. we have 1 or more developer, and can access url with different quota (each quota will be set)

2. different access target endpoint : sample below

developer 1 : 

- target endpoint 1 : https://sample.com/test/v2/fullparameter (quota set 3 per day)

- target endpoint 2 : https://sample.com/test/v2/2parameter (quota set 2 per day)

- target endpoint 3 : https://sample.com/test/v2/checkquota (quota set 5 per day)

developer 2 : 

- target endpoint 1 : https://sample.com/test/v2/fullparameter (quota set 5 per day)

- target endpoint 2 : https://sample.com/test/v2/checkquota (quota set 5 per day)

Each quota will be reduced in a different target URL link, in existing i try to explore : that quota still affected total ( sample if i try target server 3 times, results is when hit target 2 and 3 quota exceeded,. 
if anyone who can share sample xml file it will helping me for troubleshoot and configuration check

be

1 5 205
5 REPLIES 5

I'm sorry, I'm not clear on what you're asking. 

Maybe you could restate it in a different way, and maybe simplify the question?

Hi dchiesa1

ok let me more clear :

Can we limit quotas based on 3 different URL paths, and this quota does not reduce each other's URL paths in the same proxy?

thanks

The Quota policy allows an Identifier element, which specifies the "bucket" that counts get accrued into. The Identifier can refer to a context variable.

So you could use <Identifier ref='proxy.pathsuffix'/> to have a distinct quota counter allocated PER inbound path. (This is not the same as target path.)  Keep in mind that if you use proxy.pathsuffix as the identifier, then you will have a single bucket for all apps, all clients.  If you have 17 apps that all can potentially invoke that path, all of those requests get counted into the same bucket. This means a single app, if it quickly sends a large volume of requests, could consume all the available quota, and as such deny service to all other apps. This may or may not be what you want.

If you want to count on the basis of the tuple of {clientapp, path}, to prevent the denial-of-service scenario I just described, then you need to create a composite variable that includes both of those things. That would tell Apigee to create quota buckets that would limit client app A, invoking path /foo/bar, to ... some known limit.  And client app B invoking the same path, would have a separate counter. 

When I use the word "client", I mean the client identifier. If you have a single client ID that gets used in many many instances of an app (let's say the same client used by every employee), then ... again, using client ID as part of the quota identifier means you could. have a denial-of-service scenario in which one USER could quickly send requests , consuming all available quota, and then all subsequent requests from other users would be denied.  If you want to limit based on the instance of the app, then you need to include the token into the Quota identifier. or maybe user id.  some other thing that would uniquely identify the individual instance of the app. 

Regardless what you decide for your identifier, if it includes some dimension of the inbound request path (like proxy.pathsuffix), you can attach such a Quota policy to the proxy Request flow (typically proxy Request Preflow), and it will work as you expect. If you want to count by target path, then you need to include a variable like target.url (or similar) into the Identifier, and attach the Quota policy to the target request flow (again probably request preflow), which is the earliest message processing phase in which the value of target.url is known.

There's a lot going on here. The Apigee Quota policy is very flexible. Stick with it, it will probably address your needs.

Let me try and explore for your suggestion :
"want to count by target path, then you need to include a variable like target.url (or similar) into the Identifier, and attach the Quota policy to the target request flow (again probably request preflow), which is the earliest message processing phase in which the value of target.url is known."

my expectation is
1 proxy with 2 or more apps(client) with 5 different url (Different quotas for each target URL)


thanks for advice and will back if solved and my expectation ya,. very thanks

 

Hi @dchiesa1 

Let me try to clear it out.

Say we have 1 proxy which has many target endpoints differentiate by the

RouteRule on the proxy endpoint. Currently the quota policy is put on PreFlow proxy endpoint. What we want to ask:
1. Is it possible to implement the quota policy on the target endpoints?  We are using identifier "client_id" in verifyAPIkey so it can be proceed by quota policy.
2. Need your advice and share if you have the sample. so, when we have 1 apps (my client) which have different target endpoints (in same proxy), we are able to set the quota separated.