In Flask-RESTful we add an api route like the below
api.add_resource(CuteKitty,'/api/kitty')
class CuteKitty(Resource):
def get(self): return {}
def post(self): return {}
def put(self): return {}
def delete(self): return None, 204
so that GET /api/kitty
--> to CuteKitty.get()
method; like this for all HTTP verbs
Lets say that I need to provide my api consumers with a cute api like
POST /api/kitty/drink/milk ---> CuteKitty.drink(what="milk")
POST /api/kitty/meow ---> CuteKitty.meow()
How can i achive the above routing with api.add_resource
class CuteKitty(Resource):
def get(self): return {}
def post(self): return {}
def put(self): return {}
def delete(self): return None, 204
def drink(self,what="milk"): return {}
def meow(self): return {}
Like wise how to add route like /api/kitty/<int:kitty_id>/habits
--> CuteKitty.habits(kitty_id)