Refactoring and code style in api.post package.