Creating an API limit and 'tollgating' it with RM Server
Hi guys,
I have two questions. The first is trying to understand the feasibility of exposing a REST API that's limited to the # of calls (much like the free Server) using RM Server. For example, I can easily expose a Twitter keyword research tool with Server's API capabilities but how do I limit the calls? Is there a parameter I need to pass when creating the API in Server?
Second question. If I can limit these calls, I'd like to be able to integrate a tool that will allow external users to create accounts and pay a fee to get more API calls. Much like what Aylien does. Any suggestions on 3rd party tools or ideas on how to do this?
Answers
-
Hi Tom!
Your API would probably authenticate your users (e. g. with a token to be transmitted as a parameter or in the request).
You need a fast data store (like a database) that tracks the daily usage of each client. If the limit is reached, your process returns an error message. Paying clients are tracked using the same process, but they have a higher limit.
If you get the database right (low latency, good indexes on the table), this would only add a few milliseconds to your service's run time.
Regards,
Balázs
2 -
@BalazsBarany thanks. How's the latency of PostgreSQL? Or would using Redshift on AWS be better?
0 -
Hi!
Where's your server? For good latency, it should be "near" the database. A local database is best, one in the local network is fine, one in the same AWS zone might work. Cloud database and local server is bad.
AFAIK Redshift is not made for operational database purposes. It is an analytic database. I guess it would suck for this purpose.
I'd go with a local PostgreSQL, SQlite or HSQLDB on the server where the RM Server is running.
Regards,
Balázs
1