Re: New feature: HTTP API
Am 24.05.2016 um 20:38 schrieb Michael Slusarz: > The identifier is a JSON string (c01) and needs to be in quotes, at a minimum. Yes, that's it. Sorry, I was too blind to see that. Thanks. Peer -- Heinlein Support GmbH Schwedter Str. 8/9b, 10119 Berlin http://www.heinlein-support.de Tel: 030 / 405051-42 Fax: 030 / 405051-19 Zwangsangaben lt. §35a GmbHG: HRB 93818 B / Amtsgericht Berlin-Charlottenburg, Geschäftsführer: Peer Heinlein -- Sitz: Berlin
Re: New feature: HTTP API
> > On May 24, 2016 at 12:20 PM Peer Heinlein >wrote: > > Thanks for the new HTTP API. > > I get the API with some commands up and running, but I'm still not able > to create folder. > > curl -k -H "Content-Type: application/json" -H "Authorization: Basic > secret" -d > > '[["mailboxCreate",{"user":"u...@example.org","mailbox":["INBOX/TEST"]},c01]]' > https://xxx.xxx.xxx.xxx.:8080/doveadm/v1 > The identifier is a JSON string (c01) and needs to be in quotes, at a minimum. > > and also > > curl -k -H "Content-Type: application/json" -H "Authorization: Basic > secret" -d > > '[["mailboxList",{"user":"u...@example.org","mailboxMask":["INBOX/TEST"]},c01]]' > https://xxx.xxx.xxx.xxx.:8080/doveadm/v1 > > doesn't work. > > It /should/ create INBOX/TEST -- but doveadm always says it's "Invalid > JSON input". > > What am I doing wrong? > michael
Re: New feature: HTTP API
Thanks for the new HTTP API. I get the API with some commands up and running, but I'm still not able to create folder. curl -k -H "Content-Type: application/json" -H "Authorization: Basic secret" -d '[["mailboxCreate",{"user":"u...@example.org","mailbox":["INBOX/TEST"]},c01]]' https://xxx.xxx.xxx.xxx.:8080/doveadm/v1 and also curl -k -H "Content-Type: application/json" -H "Authorization: Basic secret" -d '[["mailboxList",{"user":"u...@example.org","mailboxMask":["INBOX/TEST"]},c01]]' https://xxx.xxx.xxx.xxx.:8080/doveadm/v1 doesn't work. It /should/ create INBOX/TEST -- but doveadm always says it's "Invalid JSON input". What am I doing wrong? Peer
Re: New feature: HTTP API
On 2016-04-05 15:35, aki.tu...@dovecot.fi wrote: On April 5, 2016 at 12:24 PM aki.tu...@dovecot.fi wrote: > On April 5, 2016 at 9:57 AM Tom Sommerwrote: > > > On 2016-04-05 08:44, aki.tu...@dovecot.fi wrote: > >> On April 5, 2016 at 9:27 AM Tom Sommer wrote: > >> > >> > >> On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: > >> > >> > Since the API is still a little beta, it will not return anything in > >> > case > >> > doveadm does not like the arguments (that is, calls i_fatal). Also, > >> > success is > >> > often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. > >> > >> I don't see the "doveadm proxy kick" command in the list? > > > > Not all commands are included, unfortunately. Also, the list only > > shows commands that are available with doveadm as per configuration. > > Hrmm, is it possible to add a non-http inet_listener to doveadm? And > feed it commands directly? > > I really need a remote proxy kick for my director. Unfortunately it's not possible with 2.2.23. It has been fixed internally and will eventually pop out to public repo and into some release. Aki Fixed hopefully in https://github.com/dovecot/core/commit/76537b1991e7815c7a867a997f7fa2b3c17412d4 Works like a charm. Thank you so much.
Re: New feature: HTTP API
> On April 5, 2016 at 12:24 PM aki.tu...@dovecot.fi wrote: > > > > > On April 5, 2016 at 9:57 AM Tom Sommerwrote: > > > > > > On 2016-04-05 08:44, aki.tu...@dovecot.fi wrote: > > >> On April 5, 2016 at 9:27 AM Tom Sommer wrote: > > >> > > >> > > >> On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: > > >> > > >> > Since the API is still a little beta, it will not return anything in > > >> > case > > >> > doveadm does not like the arguments (that is, calls i_fatal). Also, > > >> > success is > > >> > often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. > > >> > > >> I don't see the "doveadm proxy kick" command in the list? > > > > > > Not all commands are included, unfortunately. Also, the list only > > > shows commands that are available with doveadm as per configuration. > > > > Hrmm, is it possible to add a non-http inet_listener to doveadm? And > > feed it commands directly? > > > > I really need a remote proxy kick for my director. > > Unfortunately it's not possible with 2.2.23. It has been fixed internally and > will eventually pop out to public repo and into some release. > > Aki Fixed hopefully in https://github.com/dovecot/core/commit/76537b1991e7815c7a867a997f7fa2b3c17412d4 Aki
Re: New feature: HTTP API
> On April 5, 2016 at 9:57 AM Tom Sommerwrote: > > > On 2016-04-05 08:44, aki.tu...@dovecot.fi wrote: > >> On April 5, 2016 at 9:27 AM Tom Sommer wrote: > >> > >> > >> On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: > >> > >> > Since the API is still a little beta, it will not return anything in > >> > case > >> > doveadm does not like the arguments (that is, calls i_fatal). Also, > >> > success is > >> > often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. > >> > >> I don't see the "doveadm proxy kick" command in the list? > > > > Not all commands are included, unfortunately. Also, the list only > > shows commands that are available with doveadm as per configuration. > > Hrmm, is it possible to add a non-http inet_listener to doveadm? And > feed it commands directly? > > I really need a remote proxy kick for my director. Unfortunately it's not possible with 2.2.23. It has been fixed internally and will eventually pop out to public repo and into some release. Aki
Re: New feature: HTTP API
On 2016-04-05 08:44, aki.tu...@dovecot.fi wrote: On April 5, 2016 at 9:27 AM Tom Sommerwrote: On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: > Since the API is still a little beta, it will not return anything in > case > doveadm does not like the arguments (that is, calls i_fatal). Also, > success is > often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. I don't see the "doveadm proxy kick" command in the list? Not all commands are included, unfortunately. Also, the list only shows commands that are available with doveadm as per configuration. Hrmm, is it possible to add a non-http inet_listener to doveadm? And feed it commands directly? I really need a remote proxy kick for my director.
Re: New feature: HTTP API
> On April 5, 2016 at 9:27 AM Tom Sommerwrote: > > > On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: > > > Since the API is still a little beta, it will not return anything in > > case > > doveadm does not like the arguments (that is, calls i_fatal). Also, > > success is > > often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. > > I don't see the "doveadm proxy kick" command in the list? Not all commands are included, unfortunately. Also, the list only shows commands that are available with doveadm as per configuration. Aki
Re: New feature: HTTP API
On 2016-04-04 20:22, aki.tu...@dovecot.fi wrote: A simple 1-line curl-example in the docs would do wonders :) http://wiki2.dovecot.org/Design/DoveadmProtocol/HTTP an example command would be curl -H "Content-Type: application/json" -H "Authorization: Basic username:password>" -d '[["fetch",{"user":"username","field":["uid"],"query":["mailbox","INBOX"]},"c01"]]' http://server:8080/doveadm/v1 Awesome, I got it working with the API key. Thanks :)
Re: New feature: HTTP API
> On April 4, 2016 at 5:18 PM Tom Sommerwrote: > > > > On 2016-02-20 17:09, aki.tu...@dovecot.fi wrote: > > > To use the API, you can go to http://host:8080/doveadm. > > The documentation says http://host:8080/doveadm/v1 which is it? > > > GET request will print > > out possible commands, along with their parameters. If you have set API > > KEY, you > > need to include it in the request as X-API-Key header. > > The documentation says X-Doveadm-API, which is it? > > A simple 1-line curl-example in the docs would do wonders :) > > http://wiki2.dovecot.org/Design/DoveadmProtocol/HTTP > > Thanks. > > // Tom Hi! Yes, you're right. I'll add this line to the docs as well, and also I discovered a bug in the code. It will be fixed in next release. The response indicates X-Dovecot-API, but the code uses X-Doveadm-API, this has been fixed to X-Dovecot-API. For now, if you want to use BASIC authentication, you set doveadm_password to something and use curl -H "Authorization: Basic " http://server:8080/ to get acceptable routes curl -H "Authorization: Basic " http://server:8080/doveadm/v1 to get acceptable commands and their parameters curl -H "Authorization: Basic " http://server:8080/doveadm/v1 an example command would be curl -H "Content-Type: application/json" -H "Authorization: Basic " -d '[["fetch",{"user":"username","field":["uid"],"query":["mailbox","INBOX"]},"c01"]]' http://server:8080/doveadm/v1 this should hopefully return something sensible, such as [["doveadmResponse",[{"uid":"1"}],"c01"]] Since the API is still a little beta, it will not return anything in case doveadm does not like the arguments (that is, calls i_fatal). Also, success is often indicated with 200 OK along with [["doveadmResponse",[],"c01"]]. We are going to improve the API in future release with v2, v1 is basically very analogous to using doveadm cli. Aki
Re: New feature: HTTP API
On 2016-02-20 17:09, aki.tu...@dovecot.fi wrote: To use the API, you can go to http://host:8080/doveadm. The documentation says http://host:8080/doveadm/v1 which is it? GET request will print out possible commands, along with their parameters. If you have set API KEY, you need to include it in the request as X-API-Key header. The documentation says X-Doveadm-API, which is it? A simple 1-line curl-example in the docs would do wonders :) http://wiki2.dovecot.org/Design/DoveadmProtocol/HTTP Thanks. // Tom