little refactorings
additions and improvements to the rest api
fixed database constraint in model
nicer logging/error handling