restless icon indicating copy to clipboard operation
restless copied to clipboard

API versions and throttling

Open un33k opened this issue 11 years ago • 3 comments

Not sure if you plan to add support for api version and throttling. However, I'd be really interested in your opinion on the subject and your recommendation for restless-based projects.

un33k avatar Jun 16 '14 18:06 un33k

@un33k If you are using Flask, using Blueprints is a good way to add an api version number at the beginning of all your endpoint URLs.

joshfriend avatar Sep 23 '14 14:09 joshfriend

@joshfriend. I use Django and for now, I just name the API app, v1 and later on copy app and name it v2,v3 etc. and they all can co-exist. It works and easier to maintain, but lot of duplicate code.

un33k avatar Sep 23 '14 15:09 un33k

Right now, there's no plans to add either. In Django, you should be able to achieve this via your URLconf (r('v1/whatever/', include(WhateverResource.urls())),). You should also be able to prevent a lot of duplication by simply subclassing your (previous version) resources, rather than copying everything.

As for throttling, I waffle. The real problem is that you need a persistent data store to track it & everyone has a different opinion about where they want to store that data (flat file, SQL DB, Redis, memcached, etc.) and as such, that Restless can't lean on most any specific abstraction. Lastly, it could really just be a set of decorators created as a separate library that you decorate your methods with.

However, docs on both of these things would be a good thing, so I'll add that to the TODO list.

toastdriven avatar Sep 26 '14 01:09 toastdriven