Validation and error handling

Added validation on the API endpoint field and error handling on the
paste