2
Export list of aliases and destination
Question asked by John C. Reid - 3/8/2022 at 9:39 AM
Answered
Need a way to export a list of alias emails with their destination email address(es). Have been trying to get various API calls to work ( api/v1/settings/sysadmin/export-users, etc ), but not having any luck. Does this ability exist? If so, can someone point me in the right direction?

10 Replies

Reply to Thread
0
Tony Scholz Replied
Employee Post Marked As Answer
Hello John, 

I did a tst of the API to get a list of Alias for a domain as well as the details for a single alias. You can see below that I was able to get the details. 


Is this the information that you are looking for from your Aliases?

Thank you
Tony 


Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com
0
John C. Reid Replied
Yeah, I think that gets me there. The part I guess I was missing was that it is a two step process and not a single command to list the entire domain's worth of aliases (with targets).

0
Matthew Leyda Replied
Kendra Support http://www.kendra.com support@kendra.com 425-397-7911 Junk Email filtered ISP
0
John C. Reid Replied
Thanks Matthew, but not looking for a program. This is for internal development.
0
Tony Scholz Replied
Employee Post
Hello John, 

You're welcome, if yo have any more questions please let me know. Thank you
Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com
0
John C. Reid Replied
Trying to take this solution to the next level and allow for selecting the domain on a user input. From what I see I can only retrieve the list as a domain admin. With over 300 domains, I can't store all the user/passwords for each domain's domain admin off line, so I need to retrieve the one I need with the API. 
From what I see in the docs, I would need to use:
https://domain.com/api/v1/settings/sysadmin/user/domainadmin@'.$searchDomain
However, the password is not in the returned data - even though the API Docs say it should be. Help!
1
Zach Sylvester Replied
Employee Post
Hello John, 

Thanks for the follow-up. You wouldn't have to store the passwords you could just use our impersonation feature to impersonate the domain admins. Here is an example that I made in python. 

def impersonate_user(access_info, email):
    global url
    authurl = url + "/api/v1/settings/domain/impersonate-user/"+ email # this is the url of the impersonate user function this is adding the email address of the user who you want to impersonate 
    data = requests.post(authurl, headers = {'Authorization': 'Bearer ' + access_info['accessToken']}) # this posts the access token for auth as well as the authurl varable which in turns gives it the email that you want to impeprsonate
    ImpersonatedUser_Token = data.json()['impersonateAccessToken'] # this is the impersonated user access token
    ImpersonatedUser_exp = data.json()['impersonateAccessTokenExpiration'] # this is the impersonated user expiration date for the access token.
    data = {'impersonateAccessToken': ImpersonatedUser_Token, 'impersonateAccessTokenExpiration': ImpersonatedUser_exp} # this is the impersonated user token and expiration date
    return data # returns the impersonate access token

I was having some trouble making this image readable you could right-click and download it to see it in a bigger view. 


Please let me know if this helps. 

Kind Regards, 

Zach Sylvester Software Developer SmarterTools Inc. www.smartertools.com
0
John C. Reid Replied
Thanks. I will try to wrap my head around this. What about the issue that the API says you can retrieve the password but it doesn't?
0
Zach Sylvester Replied
Employee Post
Hey John, 

I will have to do some testing for that issue. I see that you have support so I'm going to go ahead and open a ticket for you so we can investigate. 

Kind regards, 
Zach Sylvester Software Developer SmarterTools Inc. www.smartertools.com
0
John C. Reid Replied
Thanks on both points. The impersonating was just what I needed to get our scripts to work. I can now list all the aliases in a domain along with what they are pointing to.
Looking forward to the password bit.

Reply to Thread