API usage and authentication?
Question asked by Eric Tykwinski - 8/24/2020 at 1:22 PM
SmarterMail Build 7523
So a lot of the automation stuff I could do in the Legacy API seems to be harder for me in the new one.  I can login and get my authentication token as System Admin fine, I can query "/api/v1/settings/sysadmin/export-domains-list" and get a nice csv of the domains on the server, but unsure how to query domain related stuff, since "api/v1/settings/domain/primary-admin" is limited to Domain Admins, and that is the user I want to use "api/v1/auth/retrieve-login-token" on...

If you are wondering, I saw about losing the list of ActiveSync users and last sync, which seems pretty easy to do in SOAP, but figured I should write it in the new REST API since I may as well get used to it.  I'm thinking that I'm just missing something with the new authentication scheme in this API system.

1 Reply

Reply to Thread
Eric Tykwinski Replied
If anyone is interested, I wrote a quick and dirty audit script in the old API:
from suds.client import Client
ServerAdmin = "Username"
ServerPassword = "Password"
DomainURL=SmarterMailServer + "/Services/svcDomainAdmin.asmx?WSDL"
client = Client(DomainURL)
domains = client.service.GetAllDomains(AuthUserName = ServerAdmin, AuthPassword = ServerPassword)
DomainList = domains.DomainNames[0]
ActiveSyncURL=SmarterMailServer + "/Services/svcUserAdmin.asmx?WSDL"
client = Client(ActiveSyncURL)
i = 0
while i < len(DomainList):
        ActiveSyncUsers = client.service.GetActiveSyncUsers2(AuthUserName = ServerAdmin, AuthPassword = ServerPassword, DomainName = DomainList[i])
        i += 1

Reply to Thread