Hi Jorge,
“pure” REST and CQRS, in my opinion, aren’t really compatible. REST is about State Transfer. CQRS is about transporting intent, as opposed to state.
Imagine a command to confirm an order. This would typically be implemented as a POST request. If you want to return the current state of the order, you’d have to know what the client is interested in knowing about the order. The idea of CQRS is that you have different models for different “audiences” and needs.
Typically, the result of a command is just an OK (or NOT OK). So returning a 200 and perhaps some server-generated identifier should be sufficient. Then, the client can request any information from any suitable query model to know more about it.
If you DO really want to return some state in the body of the POST’s response, you can simply execute a query after the command and return that query’s result.
Hope this helps.
Cheers,
Allard