RubyFlow The Ruby and Rails community linklog

Grape API Throttling with Grape-Attack gem

Grape-Attack has your API endpoints covered. Grape-Attack is a middleware for Grape to add endpoint-specific throttling. Will also take care of setting custom rate limit headers for you.

Comments

Looks like a very good start for a gem. I like the usage of adapters. Is there something that allows per API client limiations? This user has 1K limit and the other one has 10K limit?

Absolutely, you can specify an identifier per endpoints like this: throttle max: 100, per: 1.day, identifier: Proc.new { current_user.id }

More informations in the readme :)

Oh sorry you meant per clients. Not yet but this could be a really nice feature in deed :)

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in