http_jmap: error=Unable to parse JSON request body

rsto at paranoia.at rsto at paranoia.at
Fri Mar 18 12:27:54 EDT 2016


Hi!
 
On Fri, Mar 18, 2016, at 02:58 PM, Sayid Munawar via Cyrus-devel wrote:
> But when using cURL, the RAW json data is correct:
> Mar 18 19:19:10 gaby http[28616]: JSON {    "username": "diaz at localhost",    "clientName": "CLIENT",    "clientVersion": "0.1",    "deviceName": "api"}
> but still give error "400 Bad Request"
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.
> Then i compare the json_loads implementation from http_jmap.c and
> jcal.c, and then remove the `json_is_array` condition
 
Please don't. At the /jmap URL any request MUST be embedded in an array
(see "The structure of an exchange" [2]).
 
E.g. this is what I send to my experimental JMAP Cyrus branch to obtain a list of test user's calendars:
 
$ curl \
-X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        --user test:test \
-d @getcals.js \
        http://localhost/jmap
 
where getcals.js contains:
 
[
["getCalendars", { }, "#1"]
]
 
It should work out of the box also in your environment, even if the user
does not yet have any calendars.
 
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.
 
Hope it helps. Please let me know if you got JMAP working in your
environment.
 
Cheers,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20160318/470315ea/attachment.html>


More information about the Cyrus-devel mailing list