api respond with an error
Question asked by amir bijani - 8/16/2018 at 9:39 AM
I have to smarter mail with the same version (SmarterMail Enterprise Edition Version: 16.3.6585), when I send an API request, in first on, I got the right answer, but in the second one I got this error  : 
object(stdClass)#1 (1) { ["GetAllDomainStatisticsResult"]=> object(stdClass)#2 (3) { ["Result"]=> bool(false) ["ResultCode"]=> int(-2) ["Message"]=> string(34) "Failed to retreive the domain list" }
it is interesting that in this second one, I can get spool count by API, but when I want to use this function(GetAllDomainStatistics), I get an error. 
also in the logs, there is no log about API!
so what is your opinion about that?

3 Replies

Reply to Thread
Employee Replied
Employee Post
Hello Amir,
To enable logging for the API, please log into SmarterMail as an Administrator and click on Troubleshooting in the navigation pane. On the Options tab, on the Process Logging card, ensure API Service is set to Detailed. You'll then be able to review API logging on the View Logs tab by changing the dropdown to API Service. 
Unfortunately, it's hard to say what could be causing this error, as there is a whole block of code that could be failing: 1.) couldn't load domains; 2.) couldn't retrieve disk space by domain; 3.) couldn't get stats per domain; or, 4.) couldn't concatenate all the data together.
The review to check whether this API call is working as expected would be best suited by our Support Department. If you are interested in contacting Support for troubleshooting, I'd be happy to reach out to you via email to gather your account details. Please let me know. 
Robert Mitchell Replied
Just to add to this thread, I don't see API as an category in the Process Logging panel, has it been moved?  
  We are trying to track down why we are getting 403 errors with the REST api using Postman to GetUser, after authenticating with our admin and Authenticate-user.  We provide the bearer token in the GetUser but 403 is the result.   I was hoping some logging would help us here, but i don't see any related information in the log.

In the latest version of Smartermail July 15th,2021,  the "Process Logging" categories are the following.
Content Filtering
Folder Auto-Clean
IMAP Retrieval
Mailbox Importing
Mailing Lists
POP Retrieval
Spam Checks

Tony Scholz Replied
Employee Post Marked As Answer
Hello @Robert, 

The API logging was removed and added to the Error logs. ( https://www.smartertools.com/smartermail/release-notes/current )

Build 7810 (May 20, 2021)
Removed: API Service Log removed from backend and web interface. (Note: Any pertinent logging was moved to errors logs.)

Is this the call that you are trying to make?

This call is limited to users only 

So what you will need to do is to either authenicate as this user or after authenticating as a higher level user you will than need to impersonate this user and pass along the impersonation bearer token. 

I hope this helps. 

Thnak you
Tony Scholz System/Network Administrator SmarterTools Inc. (877) 357-6278 www.smartertools.com

Reply to Thread