This topic is locked

REST API rate limiting

9/1/2020 12:50:41 PM
PHPRunner General questions
M
MikeT author

Are there any plans to include some kind of rate limiting features for (authenticated) calls to the phpr REST API?

Myr0n 9/2/2020



Are there any plans to include some kind of rate limiting features for (authenticated) calls to the phpr REST API?


I think that PHPRunner has given all the tools so that we can implement this function ourselves and by doing this we can better adapt it to our needs.
Please check a code snippet for this implementation in this thread.

M
MikeT author 9/2/2020

Thanks! I a came up with something similar in my dev-project, lol.

I was mainly asking if something is coming / is planned anyway by xlinesoft. I think it would be a great feature to have and also in the spirit of the program, but f course one can always roll its own version.
Cheers, Michael

Sergey Kornilov admin 9/2/2020

This sounds like a really interesting feature and as a developer, I like it a lot. Yes, it is possible to implement it right now using events. When data is accessed via REST API events executed and you can access those events to log the usage and prevent data from being served if they are over the limit. You can find more info about events that will be executed at https://xlinesoft.com/phprunner/docs/about-rest-api.htm
Right now we do not plan to implement this feature in PHPRunner simply because there are too many different options. For instance, there can be different plans. You can limit data by the number of records, by the number of megabytes sent, by the total number of requests. You can use daily, monthly or yearly limits. You can have different options of what to do if the user is over limit like stop serving immediately, send the notification, throttle their connection rate, switch them to free plan etc. Just too many possible options.