refactor api, get total count in post response