REST API Get Calendars

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
zimbrat0r
Posts: 3
Joined: Tue Aug 25, 2020 7:53 am

REST API Get Calendars

Post by zimbrat0r »

Hi !

I'm using the REST API to query the calendar items of users.
The only way i'm able to do that for now is to connect by using the users credentials.

I would like to know (not found in the doc :( ) if there is a way to connect by using "impersonation" using REST API.

Thanks at all for your help (i'm using Python).
User avatar
barrydegraaff
Zimbra Employee
Zimbra Employee
Posts: 242
Joined: Tue Jun 17, 2014 3:31 am
Contact:

Re: REST API Get Calendars

Post by barrydegraaff »

There are a number of ways to do this.

One easy way is to set up preAuth on your domain, that way you can get an authtoken for any user you need to get the calendar of, and then use the REST API as you already now. If you implement your own pre-auth mechanism be careful not to expose/open it to the public as this may have security implications. https://wiki.zimbra.com/wiki/Preauth get an auth token, then you can use REST!

Another way is using an admin account to get the calendar using SOAP. One way to find out how to do this is take a look at what the zmmailbox command does when you invoke it via the CLI on the server

Code: Select all

 zmmailbox -d -z -m info@example.com -t 0 getRestURL "/calendar"
This will dump all SOAP requests to the terminal, so you can implement whatever you need from that in your application.
--
Barry de Graaff
Email: barry.degraaff [at] synacor [dot] com
Admin of Zimbra-Community Github: https://github.com/orgs/Zimbra-Community/ and the
Zimlet Gallery https://gallery.zetalliance.org/extend/
zimbrat0r
Posts: 3
Joined: Tue Aug 25, 2020 7:53 am

Re: REST API Get Calendars

Post by zimbrat0r »

Thanks for your reply i managed to do it by using auht, thanks again !
Post Reply