Reduce the amount of information returned from standard service actions I have a Drupal 7 Services that my frontend call when I want to get (for example) all comments of node XYZ. All works, but I want to reduce informations that this call return (yes, from the backend). For example "hostname, mail, changed, registered_name, signature" are all data that I don't want to return back. Other example: if I call "user/X" service path it return "password, mail" and other informations that I consider private.

So, how can I intercept and remove this data before that service module send it back to the caller?
For user objects specifically there's hook_services_account_object_alter(), e.g.

function MYMODULE_services_account_object_alter($account) {
  unset($account-&gt;mail);
}


For other entity/resource types there's hook_services_request_postprocess_alter(), e.g.

function MYMODULE_services_request_postprocess_alter($controller, $args, &amp;$result) {
  // Manipulate $result till your heart's content.
}