RESTful API versioning using Tornado
Clash Royale CLAN TAG#URR8PPP
RESTful API versioning using Tornado
I have a RESTful service which was written using the Python asynchronous web framework Tornado
I am trying to support API versioning inside my RESTful service, so I can support simultaneous versions of the same API.
One clear way is to simply add the version to the URL path and route each path to a different API class, as follows:
http://mydomain/api/v2/myapi/myarg
http://mydomain/api/v1.1/myapi/myarg
http://mydomain/api/v1/myapi/myarg
But this will result in a tangled and duplicated code.
Another way would be to get the version by header, and check the version inside the API class, and operate accordingly.
This way is also not very native, and seems like a patch to solve the use of API versioning.
It will force me to call the "IF-SWITCH" code that checks the version explicitly in each API class.
Is there a way to do API versioning in Tornado in a more native way?
(where the versioning is treated using some hidden Tornado code, such that is done with other Tornado decorators).
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.