Api controller methods rebased

reviewed the code, my only contribution was taking care of a merge conflict in Gemfile