rewrite the handler to handle different api request.