Contact Manager -> Communication Types API
Open Discussion
As a server administrator I would like to be able to set the contacts used in /var/cpanel/clevels.conf using an API call, to avoid having to manually adjust the settings in the file.
For now, you can get by with a scripted approach using Perl's WWW::Mechanize library (or selenium, etc.).
I wrote a small script and pasted it up on GitHub based on WWW::Mechanize:
https://gist.github.com/troglodyne/a8fc15a7ea895777de2e372b64fc873b
Do be aware that the POST endpoint for scripts2/saveeditcontact will actually *set all values to zero* if you don't pass in every single key found in /var/cpanel/clevels.conf (in the example script I warn about it, but they can be passed in like --CONTACTAIM 1, ...). The script also has a --host flag if you don't wanna operate on 127.0.0.1.
For now, you can get by with a scripted approach using Perl's WWW::Mechanize library (or selenium, etc.).
I wrote a small script and pasted it up on GitHub based on WWW::Mechanize:
https://gist.github.com/troglodyne/a8fc15a7ea895777de2e372b64fc873b
Do be aware that the POST endpoint for scripts2/saveeditcontact will actually *set all values to zero* if you don't pass in every single key found in /var/cpanel/clevels.conf (in the example script I warn about it, but they can be passed in like --CONTACTAIM 1, ...). The script also has a --host flag if you don't wanna operate on 127.0.0.1.
Replies have been locked on this page!