Results 1 to 9 of 9

Thread: Zimbra API's/Web service

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    5

    Default Zimbra API's/Web service

    Hi,

    We are developing an system where we need to save the contacts from our portal to zimbra contacts.
    Our portal is developed Ruby On Rails.
    We have already developed an zimlet to save contact from Zimbra to portal through web services.

    But the issues is that we don't have any api or web-services to save the contact from our portal to zimbra server.

    I will be thankful if any one give us some solution over this.


    Regards
    Milind

  2. #2
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    5

    Default

    You can use the Zimbra SOAP API from Ruby. The API documentation is currently only available as soap.txt from the source ZimbraServer/docs/soap.txt

    You'll want to check the latest source, which can be obtained from our perforce server (codes.zimbra.com) or there is a bundle of the src at:

    Browse Zimbra Community Builds & Projects Files on SourceForge.net

    Building Zimbra using Perforce - Zimbra :: Wiki

    Looks like there is a command:

    <CreateContactRequest [verbose="0|1"]>
    <cn [l="{folder-id}"] [t="{tags}"]>
    <a>...</a>+
    </cn>
    </CreateContactRequest>

    Also, search these forums to see if anyone has called the Zimbra SOAP API from Ruby. There might be an example...might not be of creating a contact but would be a good start.

  3. #3
    Join Date
    May 2009
    Location
    Bremen, Germany
    Posts
    122
    Rep Power
    6

    Default

    To create a new distribution list, I use the attached ruby code. It based on code from Adding Appointments in Zimbra with Ruby and SOAP | Tyler Lesmann.

    I use ruby 1.8.7 with soap4r 1.5.8 (gem)

    The send_soap2 returns the response as a string, instead of a SOAP::Mapping:Object. The is due to a parse error of the soap4r xml parser. If the error occurs, I use REXML to parse the string myself.
    Attached Files Attached Files
    Last edited by jummo; 01-14-2010 at 05:35 AM. Reason: insert URL

  4. #4
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    5

    Default

    hi jummo,

    Thanks for the reply.
    We tried the code you send as zip.

    The code we changed are as below
    host = 'xxx.xxxx.com'
    user = 'xxx.xxx@xxx.com'
    password = '****'

    We are getting response as Request not allowed on port xxxx.
    We tried to change the ports, but it didn't worked.

    We are saving the contact to an user login not through the admin login.

    Any suggestions for these.
    Do we need any changes to on zimbra servers?

    Regards
    Milind

  5. #5
    Join Date
    May 2009
    Location
    Bremen, Germany
    Posts
    122
    Rep Power
    6

    Default

    The example is for admin SOAP requests. For the non-admin SOAP requests you have to edit the zimbra.rb file.

    In method send_soap and send_soap2
    Code:
        url = 'https://' + host + ':7071/service/admin/soap/'
    to
    Code:
        url = 'https://' + host + '/service/soap/'
    In mehtod self.authenticate change
    Code:
          {   
            'xmlns' => 'urn:zimbraAdmin',
          },  
          [   
            element('name', name),
            element('password', password),
          ]
    to
    Code:
              {   
                'xmlns' => 'urn:zimbraAccount',
              },  
              [   
                element('account', name, {'by'=>"name"}),
                element('password', password),
              ]
    And in the method CreateContactRequest
    Code:
              {
                'xmlns' => 'urn:zimbraAdmin',
              },
    to (I think it's zimbraMail, look at soap.txt in the src)
    Code:
              {
                'xmlns' => 'urn:zimbraMail',
              },

  6. #6
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    5

    Default

    Hi,

    Means it is possible to create contact from Ruby on rails application to zimbra server?

    And what about if some one create contact into zimbra it should automatically create contact into ruby on rails application or it should give some event.

    I have zimlet which is doing same but I need to do it without zimlet, since in zimlet user has to drag and drop the contact on zimlet.

    I need a event of doing same. Or block user to create contact into zimbra.

  7. #7
    Join Date
    Jan 2010
    Location
    Mumbai, India
    Posts
    5
    Rep Power
    5

    Default

    Hi,

    When ever i try to connect zimbra from our local porta which is a ruby on rails application i always get error like "`connect': certificate verify failed (OpenSSL::SSL::SSLError)". Can someone help me on this!!

    Regards,
    Rohit

  8. #8
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    5

    Default

    Hi,

    You can modify send_soap and send_soap2 methods,

    stream = SOAP::HTTPStreamHandler.new(SOAP::Property.new)
    stream.client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE

    Regards,
    Rahul P. Chaudhari

  9. #9
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    5

    Default

    Hi,

    I am able to create contact from rails application into Zimbra address book.

    Now I want to know is it possible to block user from adding and modifying contact of address book from UI of zimbra mail box?

    Or

    Is it possible, if some one modified contact into zimbra it should be get reflected into rails application without dragging of that contact on zimlet?

    Regards,
    Rahul P. Chaudhari

Similar Threads

  1. /tmp filling
    By Nutz in forum Administrators
    Replies: 8
    Last Post: 02-22-2008, 01:00 AM
  2. zmperditionctl start asking for password
    By k7sle in forum Administrators
    Replies: 32
    Last Post: 02-20-2008, 10:13 AM
  3. 4.5 Upgrade failure
    By brained in forum Installation
    Replies: 9
    Last Post: 03-03-2007, 02:30 PM
  4. 3.1 on FC4 problems
    By cohnhead in forum Installation
    Replies: 8
    Last Post: 05-26-2006, 11:16 AM
  5. Fedora Core 3, Clean Install - Not working!
    By pcjackson in forum Installation
    Replies: 17
    Last Post: 03-05-2006, 06:38 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
  •