How to perform rate limiting in rest API?