handle exceptions in the rest api
Send the endpoint to the REST API
Add tests for the REST API