views:

871

answers:

4

I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ?

+1  A: 

Well, I have an answer to my question : you may use the "zmmailbox" command. Under the Zimbra system user, it is possible to modify content in a mailbox. Since quite everything is stored in the Zimbra mailbox, contacts can be edited. I need now to find a way to use this :

box$ zmmailbox help contact

  autoComplete(ac)             [opts] {query}
    -v/--verbose                 verbose output

  autoCompleteGal(acg)         [opts] {query}
    -v/--verbose                 verbose output

  createContact(cct)           [opts] [attr1 value1 [attr2 value2...]]
    -i/--ignore                  ignore unknown contact attrs
    -f/--folder <arg>            folder-path-or-id
    -T/--tags <arg>              list of tag ids/names

  deleteContact(dct)           {contact-ids}

  flagContact(fct)             {contact-ids} [0|1*]

  getAllContacts(gact)         [opts] [attr1 [attr2...]]
    -f/--folder <arg>            folder-path-or-id
    -v/--verbose                 verbose output

  getContacts(gct)             [opts] {contact-ids} [attr1 [attr2...]]
    -v/--verbose                 verbose output

  modifyContactAttrs(mcta)     [opts] {contact-id} [attr1 value1 [attr2 value2...]]
    -i/--ignore                  ignore unknown contact attrs
    -r/--replace                 replace contact (default is to merge)

  moveContact(mct)             {contact-ids} {dest-folder-path}

  tagContact(tct)              {contact-ids} {tag-name} [0|1*]
edomaur
On Zimbra 6, I have also used "zmpython", which is a wrapper around Jython 2.5, to access native Java API. It's not actually working but it shows some promises.
edomaur
A: 

There's actually also a SOAP interface in Zimbra but from what I've been able to tell by reading the forums at zimbra.com/forums, for some reason they "could not" (?!) document it properly, nor generate any WSDL file; thus I've never used it.

Apparently one would have to study the Java source code of Zimbra to see what's available.

conny
That's what I am doing now :-P I think I will write down a wsdl for the client web services (there is already something for the admin web services)
edomaur
A: 

If you have a recent install of Zimbra, you should be able to find the SOAP docs in /opt/zimbra/docs. I've not tried to use it yet myself....it's still Greek to me.

Matt

Matt
+2  A: 

You can send SOAP to ZCS, the details are in soap.txt (located under /opt/zimbra/docs). To modify a contact see ModifyContactRequest. You'll need to authenticate first using AuthRequest. Tons of good Zimbra developer information is here: http://www.zimbra.com/forums/developers/

skhavari