Refactored code in rest_api.py: 	DRY'ed up error message 	Reduced multiple checks into one.
Refactored code in rest_api.py:
	DRY'ed up error message
	Reduced multiple checks into one.

fuentesj/easy-key-z,fuentesj/easy-key-z,fuentesj/easy-key-z