Ha, I've built my stuff several years ago so things might have been different then. I'll have to look at it again (but y'know, no need to touch stuff that keeps working...)
Edit: or it might be that our mail is in 365 but the AD is still partially on premises...
On-prem Active Directory also has AD Web Services (https://technet.microsoft.com/en-us/library/dd391908(v=ws.10...) that I guess you could use instead of this, but a simple rest api like this will be easier to integrate with.