<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Hi!<br></div>
<div> </div>
<div>On Fri, Mar 18, 2016, at 02:58 PM, Sayid Munawar via Cyrus-devel wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div><p>But when using cURL, the RAW json data is correct:<br></p><div><span class="font" style="font-family:monospace, ' monospace'">Mar 18 19:19:10 gaby http[28616]: JSON {    "username": "diaz@localhost",    "clientName": "CLIENT",    "clientVersion": "0.1",    "deviceName": "api"}</span><br></div>
<p>but still give error "400 Bad Request"<br></p></div>
</div>
</blockquote><p class="p1"><span class="s1">Cyrus does not yet implement JMAP authentication. Even if it would, this request should be posted at the URL as discovered by the .well-known/jmap URL (see JMAP Authentication [1]). For now, please use HTTP Basic authentication.</span><br></p><blockquote type="cite"><div dir="ltr"><div><div>Then i compare the json_loads implementation from http_jmap.c and jcal.c, and then remove the <span class="font" style="font-family:monospace, ' monospace'">`json_is_array`</span> condition<br></div>
</div>
</div>
</blockquote><div> </div>
<div>Please don't. At the /jmap URL any request MUST be embedded in an array (see "The structure of an exchange" [2]).<br></div>
<div> </div>
<div>E.g. this is what I send to my experimental JMAP Cyrus branch to obtain a list of test user's calendars:<br></div>
<div> <br></div>
<div>    $ curl \<br></div>
<div>        -X POST \<br></div>
<div>        -H "Content-Type: application/json" \<br></div>
<div>        -H "Accept: application/json" \<br></div>
<div>        --user test:test \<br></div>
<div>        -d @getcals.js \<br></div>
<div>        <a href="http://localhost/jmap">http://localhost/jmap</a><br></div>
<div> <br></div>
<div>where getcals.js contains:<br></div>
<div> <br></div>
<div>    [<br></div>
<div>        ["getCalendars", { }, "#1"]<br></div>
<div>    ]<br></div>
<div> <br></div>
<div>It should work out of the box also in your environment, even if the user does not yet have any calendars.<br></div>
<div> </div>
<div>FYI - the JMAP implementation in Cyrus is at various stages of maturity: contacts are calendars are almost feature-complete (except for attachments). Messages are barely usable.<br></div>
<div> <br></div>
<div>Hope it helps. Please let me know if you got JMAP working in your environment.<br></div>
<div> <br></div>
<div>Cheers,<br></div>
<div>Robert<br></div>
</body>
</html>