2
Getting an error in Calendar API
Question asked by Raj Patel - 2/10/2022 at 1:44 AM
Answered
Hello,

I want to integrate SmarterMail Calendar API to get all the events from my calendar. After receiving the authentication token, I passed it to "api/v1/calendars/events-all/{owner}/{id}" GET API. 

In response I'm getting 400 error - Did not have shared calendar connections with.

As there is no proper documentation available for REST APIs, I'm getting confused in this. What it is and what to do? Can anyone assist me with this?

4 Replies

Reply to Thread
1
Tony Scholz Replied
Employee Post
Hello Raj. 

The API call to get Calendar events is restricted to the user level. For this to work you will either need to authenticate as the user or after authenticating as a high level user you can then impersonate that user. 


An authentication token is REQUIRED for this call. This call is limited to Users.
GET api/v1/calendars/events-all/{owner}/{id}

You can see more details on setting this up in PowerShell here ( https://portal.smartertools.com/community/a94587/powershell.aspx#135317 ) or Python ( https://portal.smartertools.com/community/a94266/smartermail-api-python-wrapper.aspx

Here is an example. 



There may be an issue in how you are authenticating or calling the API command. Hope this helps. 

Thank you
Tony
Tony Scholz
System/Network Administrator
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Tim Uzzanti Replied
Employee Post Marked As Answer
Tony... Thanks for help Raj out.  
Tim Uzzanti
CEO
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Jay Dubb Replied
@Tony, as to the "high level user" account to impersonate the user, does that have to be a top-level System Admin account, or can a local Domain Admin account be used for that?  (Currently domain admins do not have impersonation ability-- we've made that request, but no idea if/when that will happen, tho.)

We have a client that needs their CRM to be able to manipulate multiple users' contact lists via the API.  It's on a shared server, so we cannot give out a full system-admin account, but we CAN give a domain-admin-level account if necessary.

Would that work?
 
0
Tony Scholz Replied
Employee Post
Hello Jay, 

Currently this will need to either be a System Admin account with impersonate rights or you can use the users account assuming that you have the username and password for the account. A domain admin ( or Primary Domain Admin ) would not be able to do either call, unless it was for their own accounts. 

I know that this has been requested in the past, currently it is not possible for domain admins. 

A workaround for this would be to enable the option for domain admins to see passwords. Then you can use the user and password to edit the account. 

authenticate as a domain admin
grab password for user
authenticate as that user 
make your changes

Rinse and repeat. There are a few extra steps in there but you should still be able to get it to work without providing your system admin to a client on a shared box. 

Thank you
Tony

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

Reply to Thread