forked from jmapio/jmap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
70 lines (50 loc) · 6.51 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700' rel='stylesheet' type='text/css'>
<link href="main.css" rel="stylesheet" type="text/css">
<title>JSON Mail Access Protocol Specification (JMAP)</title>
</head>
<body>
<header>
<div id="logo">JMAP</div>
<ul id="nav">
<li class="nav-item"><a class="nav-link" href="index.html">Intro</a></li>
<li class="nav-item"><a class="nav-link" href="spec.html">The Spec</a> </li>
<li class="nav-item"><a class="nav-link" href="client.html">Using JMAP</a></li>
<li class="nav-item"><a class="nav-link" href="server.html">Implementing JMAP</a></li>
</ul>
<a id="github" href="https://github.com/neilj/jmap"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
</header>
<article>
<h1>JMAP</h1>
<h2>What is JMAP?</h2>
<p>JMAP is a transport-agnostic, stateless JSON-based API for synchronising a mail client with a mail server. It is intended as a replacement for IMAP. The specification is based on the API currently used by <a href="https://www.fastmail.fm">FastMail</a>’s web app. It aims to be compatible with the IMAP data model, so that it can be easily implemented on a server that currently supports IMAP, but also allows for reduced data usage and more efficient synchronisation, bundling of requests for latency mitigation and is generally much easier to work with than IMAP.</p>
<h2>Why is it not REST based?</h2>
<p>JMAP is actually more REST-like than most “RESTful” APIs. It is stateless, highly cacheable, supports transparent intermediaries and provides a uniform interface for manipulating different resources. However, it doesn’t use HTTP verbs to implement this.</p>
<p>When you have a high latency connection (such as on a mobile phone, or even wired connections from the other side of the world), the extra round trips required for an HTTP REST-based protocol can make a huge impact on performance. This is especially an issue when you have an order-dependency in your API calls and you need to make sure one has finished before the other can be run (for example when you mutate the state of a message then want to fetch the changes to a mailbox containing the message). In the JMAP protocol, this can be done in a single round trip. An HTTP REST-based version would require two full round trips for the same operation.</p>
<p>The JMAP protocol is transport agnostic and can be easily transported over a WebSocket, for example, as well as HTTP.</p>
<h2>Why is it not a binary protocol?</h2>
<p>A binary protocol would be arguably more compact and faster to encode/parse. However, history has shown text-based protocols are much easier to debug, and by using an existing widely-used encoding format (JSON) we make it much easier for developers to use this protocol. No need to write new custom, error-prone parsers. The difference in speed is likely to be minimal, especially if you GZIP the exchange and use WebSockets instead of HTTP.</p>
<h2>Why do labels apply to messages not threads?</h2>
<p>Mutable state has to be stored per-message, for example the <code>isUnread</code> status must apply on a per message basis, and it’s very useful to be able to flag a particular useful message rather than just the whole thread. To be able to delete a particular message to the Trash out of a thread, you need to be able to change the mailbox of that message. Sent messages should belong to the sent mailbox, but not messages you receive.</p>
<p>Meanwhile, it is simple to aggregate the information of the messages in the thread. So, for example, if any message in the thread is unread, then the thread can be considered unread. There is no need to store mutable state as a property of a thread therefore, and the less mutable state, the easier it is to manage. Finally, all known existing IMAP implementations, plus Gmail, store this state per-message, not per-thread, so it makes it easier for implementors to migrate to JMAP.</p>
<h2>Why are there flags (e.g. isUnread) separate to mailboxes?</h2>
<p>In IMAP, you can only have one mailbox but you can have mutliple flags on a single message. In other systems (where you have labels), these are really the same thing and you can have a single message in multiple mailboxes. JMAP aims to support both, so it has to be able to specify whether a mailbox can be used in combination with other mailboxes on a message, or must be the only one with the message (but does allow different flags). The clearest way of specifying what is allowed by the server is to keep the mailboxes separate to flags in JMAP as well.</p>
<h2>Why isUnread instead of isRead?</h2>
<p>Although this may seem inconsistent at first, it actually makes more sense. The “special” status is when a message is unread (this is what clients are interested in), so like isDraft, isFlagged and isAnswered, we make the special status equal to <code>true</code>. It is also consistant with the need for unread counts in mailbox objects, not read counts, and makes the definition of sorting a message list the same for isFlagged and isUnread when conversations are collapsed.</p>
<h2>I want to implement it. What do I need to know?</h2>
<p>That’s great! There are lots of resources on this website to help you. Counter-intuitive though it may seem, I recommend starting with the <a href="client.html">guide for client authors</a> to get a good feel for how the JMAP spec works. After that though, <a href="spec.html">the spec</a> is your bible and the <a href="server.html">advice for implementors</a> is your friend.</p>
<p>If you’re implementing the spec and suddenly find there’s an externally visible behaviour that’s not specified, please email <a href="mailto:editor@jmap.io">editor@jmap.io</a> so we can update the spec to nail down this corner.</p>
<h2>I want to use it to build a client. What do I need to know?</h2>
<p>Have a read through the <a href="client.html">client guide</a> to get an idea of how it works. Then you’ll want to find a JMAP server to test against.</p>
</article>
<aside>
<div class="toc-selected"></div>
<ol class="toc"></ol>
</aside>
<script type="text/javascript" src="toc.js"></script>
</body>
</html>