Unsubscribing a user from all emails via an API call?

I have implemented same logic , but values are not reflected in website User email preferences.