Does RESTful design violate the command and query segregation principle?
In our design, we have controllers that route requests to service classes.
The methods in the service classes, whether they are GET/POST/PUT, will ALWAYS have a return value:
public Dog PutDogToSleep(/*params*/)
{
dogService.Sleep(..);
return dog;
}
I can't find it right now, but I read that an HTTP RESTful request (get/post/put) should return the object on which you are running the request. For example, if you are doing a PUT, then you would perform that put and then return the current state of the object.
Since our methods are doing something (.Sleep) AND returning data, are they violating the command and query seg principle?
Does REST implementation not conform to command/query?
If you are doing REST over HTTP then RFC7231 describes exactly what behaviour is expected from GET, PUT, POST and DELETE.