move createpost method to postApi