how to create your own exchange compatible backend

26
HOW TO CREATE YOUR OWN EXCHANGE COMPATIBLE BACKEND DIVE INTO THE OPENCHANGE REST API Julien Kerihuel @jkerihuel

Upload: julien-kerihuel

Post on 15-Jul-2015

202 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: How to Create your Own Exchange Compatible Backend

HOW TO CREATE YOUR OWN EXCHANGE COMPATIBLE BACKENDDIVE INTO THE OPENCHANGE REST API

Julien Kerihuel@jkerihuel

Page 2: How to Create your Own Exchange Compatible Backend

2 of 2615/07/2013 OpenChange The World www.openchange.org

What is OpenChange?http://www.openchange.org

Page 3: How to Create your Own Exchange Compatible Backend

3 of 2615/05/14 OpenChange The World www.openchange.org

Interoperable Exchange framework

● From client to server:

● Client libraries working with every Exchange

● Server interoperable with every Outlook

● Exchange RPC Protocols (MAPI) / on top of Samba4

● Mainly written in C

● License: GPLv3 or later

● Hosted on github: https://github.com/openchange/openchange

Page 4: How to Create your Own Exchange Compatible Backend

4 of 2615/05/14 OpenChange The World www.openchange.org

OpenChange server architecture

OpenChange Server

MAPISTORE

Stackable backends - Dynamic Shared Object

[...]

Page 5: How to Create your Own Exchange Compatible Backend

5 of 2615/05/14 OpenChange The World www.openchange.org

Zero to One Paradigm

1.Language is a blocker

(C, C++, Objective-C)

2.Learning curve is too steep

3.Take too long to develop backend

Page 6: How to Create your Own Exchange Compatible Backend

6 of 2615/07/2013 OpenChange The World www.openchange.org

How to make this easier?MORE 1 AND LESS 0

Page 7: How to Create your Own Exchange Compatible Backend

7 of 2615/05/14 OpenChange The World www.openchange.org

Python-C mapistore gateway

● Python script as a backend

● Backend implements REST API (rest.py)

● Embed MAPI logic / abstract complexity● Make backends language agnostic● Speed up PoC development● Dogfooding

Page 8: How to Create your Own Exchange Compatible Backend

8 of 2615/05/14 OpenChange The World www.openchange.org

Python-REST architecture

PYTHON MOCK Server

OpenChange Server

MAPISTORE

rest.py script - PYTHON backend

REST API

KISSDB

Python-C gateway

Page 9: How to Create your Own Exchange Compatible Backend

9 of 2615/07/2013 OpenChange The World www.openchange.org

REST API Overview WHAT DOES IT LOOK LIKE?

Page 10: How to Create your Own Exchange Compatible Backend

10 of 2615/05/14 OpenChange The World www.openchange.org

REST Resource and syntax transfer

● It is all about get/set MAPI properties

● HTTP commands + JSON payload

● 1 resource for each Exchange item:● /folders, /mails, /calendars, /contacts, /attachments

● GET http://localhost:5001/folders/2

http://www.openchange.org/documentation/api/mapistore-http/index.html

Page 11: How to Create your Own Exchange Compatible Backend

11 of 2615/05/14 OpenChange The World www.openchange.org

JSON Payload

● Dictionaries of MAPI properties

● Include custom properties (id, collection, parent_id, type)

{ "PidTagChangeNumber": 12249790986447749121, "PidTagComment": "", "PidTagContainerClass": "IPF.Contact", "PidTagDisplayName": "Contacts", "PidTagExtendedFolderFlags": "AQQAABAA", "PidTagFolderType": 1, "PidTagParentFolderId": 17582897370184548353, "id": 101, "parent_id": 1, "type": "folder"}

Page 12: How to Create your Own Exchange Compatible Backend

12 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 13: How to Create your Own Exchange Compatible Backend

13 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 14: How to Create your Own Exchange Compatible Backend

14 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 15: How to Create your Own Exchange Compatible Backend

15 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 16: How to Create your Own Exchange Compatible Backend

16 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 17: How to Create your Own Exchange Compatible Backend

17 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 18: How to Create your Own Exchange Compatible Backend

18 of 2615/05/14 OpenChange The World www.openchange.org

REST Operations

HEAD /resource/<id> Does the resource exist?

HEAD /resource/<id>/{messages, folders} Returns number of items

GET /resource/<id> Return the item

GET /resource/<id>/{messages, folders} Return list of items

POST /resource/ Create a resource

PUT /resource/<id> Update a resource

DELETE /resource/<id> Delete a resource

Page 19: How to Create your Own Exchange Compatible Backend

19 of 2615/07/2013 OpenChange The World www.openchange.org

THE DEV ENVIRONMENT 3 STEPS SETUP

Page 20: How to Create your Own Exchange Compatible Backend

20 of 2615/05/14 OpenChange The World www.openchange.org

Step 1. Prepare environment

1. Clone docker repository:

$ git clone https://github.com/openchange/docker

2. Clone openchange repository with REST API support

$ git clone https://github.com/openchange/openchange

$ cd openchange

$ git fetch && git checkout jkerihuel/mapistore-python

3. Install docker 1.4.1

$ lsdocker openchange

docker and openchange repositories MUSTMUST be at the same level

Page 21: How to Create your Own Exchange Compatible Backend

21 of 2615/05/14 OpenChange The World www.openchange.org

Step 2. Run the containers

● 2 consoles required at minimum

● run sequence in the order below

Console 1:

$ make mysql

$ make restserver

Console 2:

$ make openchange

3openchange

1mysql

2restserver

Page 22: How to Create your Own Exchange Compatible Backend

22 of 2615/05/14 OpenChange The World www.openchange.org

Step 3. DNS configuration options

2 options available:

● Point DNS to openchange container

● Edit /etc/hosts and map openchange.zentyal.lan to openchange container IP address

Page 23: How to Create your Own Exchange Compatible Backend

23 of 2615/05/14 OpenChange The World www.openchange.org

Outlook options requirements

ALWAYS UNTICK THE BOX – RUN OUTLOOK IN ONLINE MODE

Page 24: How to Create your Own Exchange Compatible Backend

24 of 2615/07/2013 OpenChange The World www.openchange.org

ROADMAP AND DELIVERABLESCONTINUOUS WORK IN PROGRESS

Page 25: How to Create your Own Exchange Compatible Backend

25 of 2615/05/14 OpenChange The World www.openchange.org

Agenda

Mid-February 2015 Single-UserOutlook in online modeCRUD operationsCommon filtering/sort/restrictions support

April 2015 NotificationsPermissionsAuthentication System

May 2015 Cached modeOptimization Pass

Page 26: How to Create your Own Exchange Compatible Backend

26 of 2615/05/14 OpenChange The World www.openchange.org

Julien Kerihuel,

OpenChange Founder

[email protected]

www.openchange.org

Questions?