Without breaking the RESTful paradigm, how could you model object validation in RESTful? It’s best to explain the theoretical use case that I came up with ...
Imagine you have a system with a very thin web layer that calls calls to RESTful internal services. Let's say that the user visited the registration form and submitted it, the web layer sends the unapproved data directly to the background server, and if the service responds to validation errors in JSON format, they can be sent back to the user as HTML.
However, imagine that we want to have AJAX behavior in the form. For example, a user enters his email address, and we want to verify it using AJAX, sending an error to the user if their email address is already registered.
Does it make sense to implement a single call to check only the email address, or can the whole object be sent and verified in the internal system? If the latter, what URL could you use only to validate the object, and not to create it?
DrewEaster
source share