Refactoring - combined all API functions into single generic function, moved some functionality into PostRequest.R