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.