Results 1 to 10 of 10

Thread: Automatically add IMAP accounts via SOAP or anything

  1. #1
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default Automatically add IMAP accounts via SOAP or anything

    Hey,

    Is there a way to use the soap interface or command line to add/configure IMAP accounts? I need to be able to fully manage accounts from an external system through an automated sync. If there is a command line way, I could wrap a shell service around it or something. Any ideas are appreciated.

    Jhonny

  2. #2
    ppearl's Avatar
    ppearl is offline Zimbra Employee
    Join Date
    Jul 2007
    Location
    US
    Posts
    66
    Rep Power
    8

    Default

    If I understand your question correctly, you want to create an account and then associate an external IMAP account with it?

    If that's right, you'll want to use something like CreateAccountRequest and follow that with a CreateDataSourceRequest. Here's references to the SOAP API (you could use command line utilities too if you don't want to get into doing SOAP yourself):



    To get familiar with their usage, you may want to use the '-d -vv' arguments to zmprov / zmmailbox or perhaps using firebug / developer tools while using the Admin interface to emulate how requests are made in ZCS.

  3. #3
    prashant's Avatar
    prashant is offline Zimbra Employee
    Join Date
    Jul 2007
    Posts
    343
    Rep Power
    8

    Default

    You can use zmsoap utility to server your purpose. "zmsoap -h" will help you in creating the soap request. For structures/internals you can use links provided by Phil.
    ~=Prashant=~

  4. #4
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default

    Hey guys, thanks for your help.

    I used the soap api mentioned to create the external account. It creates but the password of the registered data source is saved as empty. I have specified along with the other info, but only the password is missing when the datasource is created.

    Here is the data I am sending:

    $param = array(
    "zimbraDataSourceName" => "same as email address",
    "zimbraDataSourceType" => "imap",
    "zimbraDataSourceEnabled" => "TRUE",
    "zimbraDataSourceUsername" => "some@domain.com",
    "zimbraDataSourcePassword" => "a non blank password",
    "zimbraDataSourceImportOnly" => "FALSE",
    "zimbraDataSourceEmailAddress" => "some@domain.com",
    "zimbraDataSourceConnectionType" => "ssl",
    "zimbraDataSourceHost" => "imap.gmail.com",
    "zimbraDataSourcePort" => 993,
    "zimbraDataSourceFolderId" => "NULL"
    );

    In order to it work, I had to manually set the password again in preferences on the web client. Does anyone know why that might happen?

  5. #5
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default

    Hey guys, thanks.

    Using that soap call I was able to create the external account ( data source). I used the fields available when doing a zmprov gds. All fields worked, except password, that goes blank. After adding the DataSource using Soap then manually updating using Preferences->Accounts, it works.

    Am I missing something here? e.g. password must be sent using any special treatment? Thanks in advance.

    Jhonny

  6. #6
    ppearl's Avatar
    ppearl is offline Zimbra Employee
    Join Date
    Jul 2007
    Location
    US
    Posts
    66
    Rep Power
    8

    Default

    Based on what other people have had problems with, I'd guess the problem you are hitting is related to getting the folder id right. Do either of the following help?



    Phil

  7. #7
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default

    Hey, I don't think it is a folder id issue, I tried using 2 ( INBOX) for id, also. Same issue: the account gets created with blank password. Creating the account using command line cmd cds with the exactly the same parameters works ( both id 2 and NULL).

  8. #8
    ppearl's Avatar
    ppearl is offline Zimbra Employee
    Join Date
    Jul 2007
    Location
    US
    Posts
    66
    Rep Power
    8

    Default

    Since you've determined that you can get things working OK with zmprov, you might try comparing the request made via zmprov (use zmprov -d -vv cds ...) and your soap request to see if you can determine any potential differences or sources of problems. There may also be useful info logged in /opt/zimbra/log/mailbox.log. If you still can't find the problem, we'll probably need to see the complete soap request here.

  9. #9
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default

    hmm, I was sure that at some point adding data sources from zmprov worked, but I am experiencing the same issue ( no password) with it, too. I tried zimbraDataSourceFolderId 2, NULL, and creating a folder then using its ID. Same result. I was using 8.0.4 and upgraded to 8.0.5 to see if was fixed. No luck. I uninstalled and installed version 7.2.5, just to make sure. Still no luck.

    Here are the SOAP messages:

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <authToken>0_5a2e1d5a3ea6280882cce66c57734ace056a9 b42_69643d33363a65306661666438392d313336302d313164 392d383636312d3030306139356439386566323b6578703d31 333a313338323238333233343032393b61646d696e3d313a31 3b747970653d363a7a696d6272613b</authToken>
    <nosession/>
    <userAgent name="zmprov" version="7.2.5_GA_2906"/>
    </context>
    </soap:Header>
    <soap:Body>
    <CreateDataSourceRequest xmlns="urn:zimbraAdmin">
    <id>6c335e06-ceef-4a5a-a8ec-33dfa6e4a8f7</id>
    <dataSource name="imap gmail" type="imap">
    <a n="zimbraDataSourcePort">993</a>
    <a n="zimbraDataSourceEmailAddress">jhonny@mydomain.c om</a>
    <a n="zimbraDataSourcePassword">mypassword</a>
    <a n="zimbraDataSourceImportOnly">FALSE</a>
    <a n="zimbraPrefFromDisplay">Jhonny Imap</a>
    <a n="zimbraDataSourceEnabled">TRUE</a>
    <a n="zimbraDataSourceHost">imap.gmail.com</a>
    <a n="zimbraDataSourceUsername">jhonny@mydomain.com </a>
    <a n="zimbraDataSourceFolderId">257</a>
    <a n="zimbraDataSourceConnectionType">ssl</a>
    </dataSource>
    </CreateDataSourceRequest>
    </soap:Body>
    </soap:Envelope>
    ===============================
    ======== SOAP RECEIVE =========
    <CreateDataSourceResponse xmlns="urn:zimbraAdmin">
    <dataSource id="17c8482c-f28f-4565-82f1-5bbd55da2d81" name="imap gmail" type="imap">
    <a n="zimbraPrefFromDisplay">Jhonny Imap</a>
    <a n="objectClass">zimbraDataSource</a>
    <a n="objectClass">zimbraImapDataSource</a>
    <a n="zimbraDataSourceConnectionType">ssl</a>
    <a n="zimbraDataSourceEmailAddress">jhonny@mydomain.c om</a>
    <a n="zimbraDataSourcePort">993</a>
    <a n="zimbraDataSourceImportOnly">FALSE</a>
    <a n="zimbraDataSourceEnabled">TRUE</a>
    <a n="zimbraDataSourceType">imap</a>
    <a n="zimbraDataSourceId">17c8482c-f28f-4565-82f1-5bbd55da2d81</a>
    <a n="zimbraDataSourceHost">imap.gmail.com</a>
    <a n="zimbraCreateTimestamp">20131020033356Z</a>
    <a n="zimbraDataSourceUsername">jhonny@mydomain.com </a>
    <a n="zimbraDataSourceName">imap gmail</a>
    <a n="zimbraDataSourceFolderId">257</a>
    </dataSource>
    </CreateDataSourceResponse>

  10. #10
    khronnuz is offline Member
    Join Date
    Sep 2013
    Posts
    11
    Rep Power
    1

    Default

    Also tried with version 7.2.x. Same issue. Does anyone know what might be happening here?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Automatically Sync IMAP?
    By BigBirdy in forum Administrators
    Replies: 1
    Last Post: 12-04-2013, 12:18 AM
  2. Replies: 1
    Last Post: 06-27-2012, 07:10 PM
  3. Replies: 15
    Last Post: 12-06-2008, 05:18 PM
  4. Replies: 10
    Last Post: 09-10-2007, 12:30 PM
  5. Set Zimbra to Automatically Download from POP3 Accounts
    By dbachman in forum Administrators
    Replies: 1
    Last Post: 08-29-2007, 09:05 AM

Posting Permissions

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