1

We would like to use gravitee as an API gateway in front of our web API, but we need to be able to offer plans that filter according to a business-specific metric, that is sent along in the response of all API calls.

Say, for instance, that our API returns in the HTTP headers the number of data that was queried (in terms of database unique points):

> GET /api/my/data

Response:
X-Number-Of-Points: 2456 ## the number of points that were returned
Content-Type: application/json

{
"points":[...]
}

So in essence, I would like to have plans like:

  • 150M points per month
  • 10k requests or 50M points per month

I took a look at Gravitee's documentation, but I am not entirely sure that we can do that.

It seems that their "Policy" plugin could be useful, but I have the feeling that I will have to implement the entire "extract nb of points from header, store it in a db, and then implement a plugin that Gravitee can tap to see if this particular client has exhausted his plan".

Maybe I didn't read the documentation correctly, but I figured that if Gravitee can do rate limiting and API-call-number-per-month plans, it should be able to collect integer metrics and apply it to a plan?

Do you guys have experience in that?

I'm not particularly attached to Gravitee per-se, but from my limited exploration of the API gateway landscape, it seemed to be the most mature of the rest (Kong, APIGee, etc.). If this particular use case is better handled by another free APM I'm up for a switch..

Gui13
  • 12,993
  • 17
  • 57
  • 104

1 Answers1

0

Sorry for being a bit late here.

In the existing rate-limiting / quota policy, you can provide a weight to a call (by default, weight = 1).

The only difference I'm seeing from your case is that the weight is coming from the response as far as I understand.

The question I have in mind is : if the gateway is looking into the response to get the weight, how should we manage an authentication issue (from the gateway), does it mean the counter is not decrement ?