[CPANEL-31073] set_application_contact_importance list of valid Apps

coursevector

Well-Known Member
Feb 23, 2015
142
14
68
cPanel Access Level
Root Administrator
Trying to use the set_application_contact_importance API, and it says you can only use valid WHm module names. But there is no list given. Looking at the Contact Manager:Notifications page, i grabbed the list of valid options from there. But there are some it won't accept, such as "AutoSSL::CertificateExpiringCoverage", it just gives me this error:

metadata:
command: set_application_contact_importance
reason: "API failure: (XID 5v6azu) The “app” parameter value of “AutoSSL::CertificateExpiring” is invalid. It must only contain alphanumeric characters."
result: 0
version: 1

I even had the app value uri_encoded, no dice. How do i handle the ones with :: or is there an official list to configure all the notification options via the API? Below is a sample call:

/usr/local/cpanel/bin/whmapi1 set_application_contact_importance app=AutoSSL::CertificateExpiring importance=1 - Errors
/usr/local/cpanel/bin/whmapi1 set_application_contact_importance app=AutoSSL%3A%3ACertificateExpiring importance=1 - Errors
 

cPJeremy

Technical Analyst
Staff member
Feb 13, 2019
58
3
83
Houston TX
cPanel Access Level
Root Administrator
Hello coursevector,

I will do my best to help you with this. There is not necessarily an official list of applications, however what you can do is run another API call to get all of the contact importance. You should be able to use this command: whmapi1 get_all_contact_importances Here is the documentation for this call: cPanel Documentation | WHM API 1 Functions - get_all_contact_importances

This API call is going to give you the app, event, importance, and name. Then you can use that information to setup the call to set this.

If you run the command as it is above, it actually provides a rather lot of output. However, here is an example for the AutoSSL certificate expiring like you asked above.

Code:
    -
      app: AutoSSL
      event: CertificateExpiring
      importance: 0
      name: Disabled
    -
So what you can then do is run the following API call for "set_application_contact_event_importance" Please note, the variables for this call are shown here: cPanel Documentation | WHM API 1 Functions set_application_contact_event_importance

Here is an example of the call you can use to change the importance:

whmapi1 set_application_contact_event_importance app=AutoSSL event=CertificateExpiring importance=High

I hope this helps! Please let us know if you have any other questions or concerns!

Thank you!
 

coursevector

Well-Known Member
Feb 23, 2015
142
14
68
cPanel Access Level
Root Administrator
I am glad to hear!

Please let us know if you require anything else!
Ran into some more issues and I suspect it may be a bug at this point. Try running the following:

whmapi1 get_application_contact_importance app=migrate_branding
whmapi1 get_application_contact_importance app=rpm.versions
whmapi1 get_application_contact_event_importance app=EasyApache event=EA4_ConflictRemove
whmapi1 get_application_contact_event_importance app=EasyApache event=EA4_TemplateCheckUpdated

It says they are invalid, but they should be. According to the docs, it says the values must be URI encoded. But an underscore and period are URI encoded. But I get this error message instead:

metadata:
command: get_application_contact_event_importance
reason: "API failure: (XID 84pfht) The “event” parameter value of “EA4_ConflictRemove” is invalid. It must only contain alphanumeric characters."
result: 0
version: 1

Can you confirm if this is a bug or if I'm doing it wrong?
 

cPJeremy

Technical Analyst
Staff member
Feb 13, 2019
58
3
83
Houston TX
cPanel Access Level
Root Administrator
Hello again, coursevector!

I am sorry for the delay but after further testing, I did find some issues on how the cPanel software handles this API call. For this reason, I went ahead and opened an internal case with our developers. The internal case ID is CPANEL-31073. Thank you for bringing this to my attention!

As you had mentioned, the API call will return that it can only accept alphanumeric characters. Well, if you remove the non-alphanumeric characters and try to run the API call, it will actually succeed but will create a new 'app' and or 'event' of that name.

Unfortunately, I do not have any ETA as to when this may be resolved but should be updated in our changelogs when a resolution is met. go.cpanel.net/changelogs - Additionally, you can use the WHM interface for the time being.

I do apologize for any inconvenience, however, please let us know if you require anything else.

Thank you!
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,261
313
Houston
Hey @coursevector

I just checked in on the case and it looks like it's still in the monitored state. I'll flag this thread for followup though so I know to check in on it.