posts API refactorings