Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

WHM API1 emailtrack_stats starttime/endtime not working?

Discussion in 'cPanel Developers' started by cyberdog88, Mar 6, 2016.

  1. cyberdog88

    cyberdog88 Registered

    Joined:
    Mar 6, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Reseller Owner
    Hi,

    As it says in the title, I'm setting starttime and endtime as a Unix timestamp as described here but seem to get back information for some unknown period, maybe a month? I'm looking for a day's results. Python code is:

    Code:
        def loadServerMailRep(self, srv_cpanel, server):
            try:
                self.last_mail_rep_check = int(time.time())
                mailrep = srv_cpanel.call_v1('emailtrack_stats', starttime=(self.last_mail_rep_check - 86400), endtime=self.last_mail_rep_check)
                server.mail_rep_history.append({
                    'time': self.last_mail_rep_check,
                    'total' : mailrep['data']['records'][0]['SENDCOUNT'],
                    'success' : mailrep['data']['records'][0]['SUCCESSCOUNT'],
                    'defer' : mailrep['data']['records'][0]['DEFERCOUNT'],
                    'fail' : mailrep['data']['records'][0]['FAILCOUNT'],
                })
            except Exception as e:
                print e
    My theory is that the docs say to set a date as opposed to a straight up time, but I'd have thought that would still work? Any pointers?

    Thanks in advance!
     
  2. cyberdog88

    cyberdog88 Registered

    Joined:
    Mar 6, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Reseller Owner
    Hi again,

    Done some further digging as below - is this functionality just broken or something?

    i.imgur.com/ppuPPM1.png

    Thanks,
    Ben
     
    #2 cyberdog88, Mar 7, 2016
    Last edited by a moderator: Mar 7, 2016
  3. cyberdog88

    cyberdog88 Registered

    Joined:
    Mar 6, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Reseller Owner
    Hi,

    Never mind - I've worked around it using emailtrack_user_stats instead - it just doesn't appear to work properly.

    Thanks
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,937
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    I tested the "emailtrack_stats" WHM API 1 function with the following parameters:

    starttime: "1456794061"
    endtime: "1456966861"

    The output correctly showed only the results between these two time periods, as opposed to showing all records when not using those parameters. Could you elaborate on what in particular is not working as expected when you test? Have you tried to reproduce your issue via "WHM >> API Shell"? It's documented at:

    API Shell for WHM - Documentation - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice