# تحديث تفضيلات البريد الإلكتروني عبر API

**URL:** <https://meta.discourse.org/t/updating-email-preferences-via-api/65983>\
**Category:** Product Support\
**Created:** [11 يوليو 2017، 5:10ص UTC](https://meta.discourse.org/t/updating-email-preferences-via-api/65983 "2017-07-11T05:10:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![kgoetz](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kgoetz](https://meta.discourse.org/u/kgoetz)\
**Post date:** [14 يوليو 2017، 2:43ص UTC](https://meta.discourse.org/t/updating-email-preferences-via-api/65983/3 "2017-07-14T02:43:52Z")

</div>

Thanks @blake, I think that has me back on the right path.

> curl -X PUT “[https://discuss.example.com/u/karl\_goetz.json?api\_key=[...]&api\_username=karl\_goetz&mailing\_list\_mode=false&email\_digests=true](https://discuss.example.com/u/karl_goetz.json?api_key=%5B...%5D&api_username=karl_goetz&mailing_list_mode=false&email_digests=true)”

Now when I refresh the web my settings have changed from mailing list mode to activity summary.

After more annoyance and reporting to reading the pydisuourse source it appears the \_PUT method doesn’t support passing params so I used their \_request method directly.

> d  
> {‘email\_always’: ‘true’, ‘mailing\_list\_mode\_frequency’: 1, ‘email\_private\_messages’: ‘true’, ‘email\_direct’: ‘true’, ‘mailing\_list\_mode’: ‘false’, ‘digest\_after\_minutes’: 1440, ‘email\_digests’: ‘true’, ‘include\_tl0\_in\_digests’: False, ‘email\_in\_reply\_to’: ‘true’, ‘email\_previous\_replies’: 1, ‘api\_username’: ‘karl\_goetz’, ‘api\_key’: ‘[…]’}  
> discourse\_client.\_request(‘PUT’, ‘/u/karl\_goetz.json’, params=d)

Which behaved as expected.

Thanks again for your assistance.

PS.  
Do you know why some user settings are only accessible via /u/username not /users/username ?

---

_[View the full topic](https://meta.discourse.org/t/updating-email-preferences-via-api/65983)._
