UAPI Email::set_always_accept documentation

swbrains

Well-Known Member
Sep 13, 2006
212
28
178
With regard to the UAPI function Email::set_always_accept documented here:

The "mxcheck" parameter has the following note:
This parameter is redundant with the alwaysaccept parameter. Do not enter the mxcheck and alwaysaccept parameter at the same time. Undefined behavior may occur if this happens.

The "alwaysaccept" parameter has the following note:
This parameter is redundant with the mxcheck parameter. Do not enter the mxcheck and alwaysaccept parameter at the same time. Undefined behavior may occur if this happens.

In the examples section, two of the examples provided (command line and cPanel/webmail session) show both parameters in use at the same time:

Code:
uapi --user=username Email set_always_accept domain=example.com mxcheck=auto alwaysaccept=1

https://hostname.example.com:2083/cpsess##########/execute/Email/set_always_accept?domain=example.com&mxcheck=auto&alwaysaccept=1
Also, in these examples, alwaysaccept is set to "1" whereas the documentation indicates that alwaysaccept's valid values are the same as mxcheck (strings): auto, local, secondary, or remote.

Am I not understanding this correctly or should only one of these two params be used at a time?
Also what are the acceptable values for the alwaysaccept parameter?

Thanks for any clarification you can provide.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
Hey there! You're completely right, and we have this resolved in our latest documentation. The "documentation" site is actually two versions old in relation to the API, and the new stuff is here:


Those examples are formatted a bit better as well.

If you still see issues, let me know and I can get the docs adjusted for clarity.
 

swbrains

Well-Known Member
Sep 13, 2006
212
28
178
Thanks! I always end up Google-ing "API cpanel __________" when I need to look up a function for a particular purpose, and it seems I've usually landed on the old API site It might be helpful if it could redirect to the new one as I don't visit it frequently enough to remember there's a newer version.

One thing I noticed on the new page is the CLI and URL examples don't specify any parameters other than <domain>. With a function called set_always_accept, I would have expected it to require a setting/value to be set -- either <alwaysaccept> or <mxcheck>, but didn't see them being set in the example. I see that other information is returned by the function, but it's unclear if the example is being used to simply query the MX information for the domain, or what the purpose of the function is when only the <domain> parameter is specified with no "action."

Thanks for any additional clarification you can provide. :)
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
While we don't have a redirect in place, there is a "Check out our new API site!" message at the top of all the pages in the Developer Documentation Home - Developer Documentation - cPanel Documentation area.

I reached out to our developers about the requirements for that API call as I wasn't able to find any official details in my research. I'll be sure to post as soon as I hear back with more information.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,923
912
313
cPanel Access Level
Root Administrator
If the command is run with no value applied, such as this example:

Code:
uapi --user=main Email set_always_accept domain=domain.com
the value is set to "auto" for the mxcheck value. In general, it is expected to provide one of the values, and I have one of our API guys making some edits to that page to make this more clear in the future.