This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Move Rate Limiting to be an object off Consumer instead off a Plugin #792
Labels
task/feature
Requests for new features in Kong
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)
The text was updated successfully, but these errors were encountered: