API returns forward information different
I always assumed if we did not change the API version, the data returned would remain the same.
Seems that is not true :-(
For years I have been calling the and found in build 59.9999.73 this comment:
Fixed case CPANEL-8000: Fix UI order of email forwarder and destination.
So am I correct to assume that whatever that change was has impacted the API calls. Any call made to a server > 59.9999.73 the dest & forward addresses are reversed?
-
Hi, As the change log noted, the problem was with the UI. The API was fine. 0 -
I went looking for the change log to see if something in the change log may explain what I see happening on the servers. I can confirm that for the two fields have been switched around in newer versions of the API. I am currently modifying our system so when we query a server we first ask for the cPanel version. Then from there we will be able to hack our code to normalize what the API is returning. 0 -
Here is a snippet of the results I get back using API 2 function Email::listforwards cPanel version - 11.56.0.36 [0] => stdClass Object ( [forward] => orders@example.com [uri_forward] => orders%40example.com [html_dest] => accounting@example.com [dest] => accounting@example.com [uri_dest] => accounting%40example.com [html_forward] => orders@example.com )
The message arrives to [dest] address (accounting@example.com) and is delivered to [forward] address (orders@example.com). This MATCHES the API documentation as of 2016-11-07. cPanel version - 11.60.0.15[0] => stdClass Object ( [html_dest] => orders@example.com [html_forward] => accounting@example.com [forward] => accounting@example.com [uri_forward] => accounting%40example.com [uri_dest] => orders%40example.com [dest] => orders@example.com )
The message arrives to [forward] address (accounting@example.com) and is delivered to [dest] address (orders@example.com). This is the exact opposite of the previous example and the opposite of the API documentation. I don't know what version of cPanel it changed in, I only mention the release notes because it sorta matches the time frame. The email makes it to the correct destination in both cases but the labels have changed, so people who are using the API and relying on [dest] and [forward] as the logic got a big suprise when it becomes reversed and their code breaks. Fortunately for us we caught it before a lot of cPanel servers have upgraded. Most of our customers are still running 58.xx and we believe the bug came in 59.xx somewhere.0 -
Hello @gunsuka, The API behavior when listing email forwarders changed in cPanel version 60 due to the following case: Fixed case CPANEL-6434: Email::list_forwarders returns documented values. For example, let's say the following email account exists under an account: test1@cptest01.tld We then setup a forwarder to forward emails from test1@cptest01.tld to test2@cptest01.tld. This results in the following output on cPanel version 58 for cPanel API 2: # cpapi2 --user=cptest01 Email listforwards domain=cptest01.tld --- cpanelresult: apiversion: 2 data: - dest: test1@cptest01.tld forward: test2@cptest01.tld html_dest: test1@cptest01.tld html_forward: test2@cptest01.tld uri_dest: test1%40cptest01.tld uri_forward: test2%40cptest01.tld event: result: 1 func: listforwards module: Email
Here's the output in cPanel 58 using UAPI:# uapi --user=cptest01 Email list_forwarders domain=cptest01.tld --- apiversion: 3 func: list_forwarders module: Email result: data: - dest: test1@cptest01.tld forward: test2@cptest01.tld html_dest: test1@cptest01.tld html_forward: test2@cptest01.tld uri_dest: test1%40cptest01.tld uri_forward: test2%40cptest01.tld errors: ~ messages: ~ metadata: transformed: 1 status: 1
This matches the documentation at: cPanel API 2 Functions - Email::listforwards - Software Development Kit - cPanel Documentation dest string The email address, in plaintext. An email address on the cPanel account, in plaintext.
forward string The address to which the system forwards mail, or the method that the system uses to handle mail, in plaintext.
However, it did not match the documentation at: cPanel API 2 Functions - Email::listforwards - Software Development Kit - cPanel Documentation I'll update this thread once the changes are published. Thank you.0 -
Hello @gunsuka, We now have a new internal case open, CPANEL-9743, to evaluate the changes referenced in my previous response stemming from CPANEL-6434. There's no decision to report at this time, but I wanted to keep you in the loop as I understand you spent some time making modifications to your custom applications to account for this change. I'll update this thread with more information as it becomes available. Thank you. 0 -
Hello, To update, the changes made in cPanel version 60 referenced in my earlier response are reverted as of cPanel version 60.0.22. The behavior now matches cPanel version 58 and earlier. Thank you. 0
Please sign in to leave a comment.
Comments
6 comments