Fleshed out REST controller

Further fleshed out the REST controller and added in error cases