Results 1 to 4 of 4

Thread: Expoort emails using REST api from command line

  1. #1
    Join Date
    Jul 2006
    Location
    Pisa
    Posts
    135
    Rep Power
    9

    Default Expoort emails using REST api from command line

    Hi

    I need to export email's folders using REST api, from command line
    using curl I tried the following command:

    curl -u myuser:mypassoword -v http://myserver/zimbra/home/lorenzof...t/myfolder.zip

    no file is saved and theverbose mode reports
    * About to connect() to myserver... port 80
    * Trying myserver..... * connected
    * Connected to myserver (myserver) port 80
    * Server auth using Basic with user 'lorenzof@seacom.it'
    > GET /zimbra/home/lorenzof@seacom.it/myfolder.zip HTTP/1.1
    Authorization: Basic bG9yZW56b2ZAc2VhY29tLml0OkFpc2NvbmRlbDU1Kg==
    User-Agent: curl/7.12.1 (i686-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
    Host: myserver
    Pragma: no-cache
    Accept: */*

    < HTTP/1.1 302 Moved Temporarily
    < Server: Apache-Coyote/1.1
    < Expires: ven, 10 nov 2006 11:29:20 GMT
    < Cache-control: public, max-age=604800, post-check=7200, pre-check=604800
    < Location: http://myserver/service/home/lorenzo...t/myfolder.zip
    < Content-Length: 0
    < Date: Fri, 03 Nov 2006 11:29:20 GMT
    * Connection #0 to host myserver left intact
    * Closing connection #0

    what is wrong ?

    thank you

  2. #2
    Join Date
    May 2006
    Location
    New York, NY US
    Posts
    23
    Rep Power
    9

    Default

    I believe you may need to use https://

  3. #3
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default Use /service instead of /zimbra

    Quote Originally Posted by lfasci
    < HTTP/1.1 302 Moved Temporarily
    < Location: http://myserver/service/home/lorenzo...t/myfolder.zip
    Try using the Location: URL suggested in the 302 response and see if that works for you.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  4. #4
    Join Date
    Aug 2005
    Posts
    228
    Rep Power
    10

    Default

    Using /zimbra/home causes a server redirect. To follow redirects with curl you need to use -L/--location:

    Code:
    curl -L -u myuser:mypassoword -v http://myserver/zimbra/home/lorenzo...it/myfolder.zip
    Though you could also just use /home (I forget which version it was added in), as it doesn't do a redirect:

    Code:
    curl -L -u myuser:mypassoword -v http://myserver/home/lorenzo...it/myfolder.zip
    I actually meant to get back to /zimbra/home/ and fix it so it didn't do a redirect, but haven't gotten to it.
    Bugzilla - Wiki - Downloads - Before posting... Search!

Similar Threads

  1. Replies: 17
    Last Post: 11-04-2008, 12:25 PM
  2. Replies: 2
    Last Post: 07-20-2006, 11:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •