I am implementing a simple web application with python (3.x) and bottle. As the APIs I want to expose might change in the future, I would like to add the possibility to have different versions.
On this topic there are some insightful answers here, but unless versioning for web APIs is a proven bad idea I'd like to give it a try anyways.
Regarding my app: for example, while version 1.0 allows the following call through a POST /resource
:
@post('/resource')
post_item(name=item_name, value=item_value)
a future version might do:
@post('/resource')
post_item(name=item_name, value=item_value, fullname=longer_item_name)
For simplicity assume the keyword parameters 'name', 'value', 'fullname' come from the FROM data fields:
<input name="name" type="text" />
Now, the first thing that comes to mind is inserting a version
parameter at the beginning, something similar to what IP is doing with its headers:
post_item(v=1, name=item_name, value=item_value)
post_item(v=2, name=item_name, value=item_value, fullname=longer_item_name)
However, it seems a bit cumbersome. Is there any web micro-framework library that helps with this? Am I falling outside what a micro framework does?