Move Rate Limiting to be an object off Consumer instead off a Plugin #7215
Replies: 5 comments
-
That does make sense to me. This would be relatively simple to implement, one just needs to extend the Admin API with an |
Beta Was this translation helpful? Give feedback.
-
Mind if I take a stab at it first? I'll ping you on Slack if I run into
|
Beta Was this translation helpful? Give feedback.
-
Sure! Just a few things then:
|
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
I recently started looking the Rate Limiting Plugin and a few things about it bugged me...
Unlike Consumers, Rate Limits cannot be pulled out as definitive objects. If you want to find a rate limit, you need to do this:
"/apis/#{api}/plugins?name=rate-limiting&consumer_id=#{consumer_id}"
Because you're filtering, instead of getting a 404 when it's empty, you get an empty Data:[]. Now that's proper for when you're filtering for a list. However that's a weird experience when you're checking to see if a rate-limit has been created yet.
My understanding : Rate Limits Belong to consumers and APIs, and Consumers can only have one rate-limit per API.
Proposed Rate Limits Format:
"/consumers/#{consumer_id}/rate-limits/#{api name, id, or rate-limit ID}" (returning a single rate limit object, as you have a 1:1 relationship here)
"/consumers/#{consumer_id}/rate-limits" (returning all rate-limits enabled for that consumer)
"/apis/#{api}/rate-limits?consumer_id=#{consumer_id}&key=#{key}" (returning the Data[""], as you're actually filtering here to see if a consumer and/or their key's rate limit)
Beta Was this translation helpful? Give feedback.
All reactions