refactors put, post and patch