Results 1 to 3 of 3

Thread: Updating contacts using REST

  1. #1
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    4

    Default Updating contacts using REST

    I'm trying to update a single contact in my addressbook by specifying the id of the contact and the VCF format (http://localhost/home/user/contacts?...th=nsc&fmt=vcf). The server accepts the contact (no errors), but instead of overwriting the contact it adds a new contact. Has anyone updated a contact successfully before?

    It doesnt have to be in VCF format. Any format will do.

    The following Java code was used to save a contact:

    public void saveItem( int itemID, String vcf ) throws Exception{
    String server = "localhost"
    URL url = new URL( server + "/home/laukvik/contacts?id=" + itemID + "&auth=nsc&fmt=vcf" );
    HttpURLConnection uc = (HttpURLConnection) url.openConnection();
    uc.setDoInput( true );
    uc.setDoOutput( true );
    uc.setRequestMethod("POST");
    uc.setRequestProperty ("Authorization", "Basic " + encoding);
    uc.setRequestProperty( "Content-Type", "text/x-vcard" );
    uc.setRequestProperty( "Content-Length", vcf.length() + "" );
    uc.setUseCaches( false );
    OutputStream wr = uc.getOutputStream();
    wr.write( vcf.getBytes() );
    wr.flush();
    }

  2. #2
    Join Date
    Dec 2006
    Location
    Minneapolis MN
    Posts
    777
    Rep Power
    9

    Default

    Did you try adding a "&resolve=replace" to the REST URL?
    01 Networks, LLC / Cybernetik.net
    Zimbra NE and OSS Cloud Hosting
    Shared Web Hosting
    Consulting Services

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    4

    Default

    Thanks for the quick response!

    I just tried with the resolve=replace parameter you specified with no luck :-( I can't seem to find that parameter in the documentation I'm using (ZCS 6.0:Zimbra REST API Reference - Zimbra :: Wiki).

    Am I looking at the wrong documentation page? Are there more documentation available on updating contacts?

    Do the update method require additional http headers not mentioned in the documentation?

    All help and pointers appreciated :-)

Similar Threads

  1. Updating Calendar Entries with REST
    By Bevan Bennett in forum Administrators
    Replies: 5
    Last Post: 10-12-2007, 09:46 AM
  2. postfix build error while building Zimbra source
    By anuradha_mihsra in forum Developers
    Replies: 6
    Last Post: 07-19-2007, 10:22 AM
  3. Howto update contacts using REST interface?
    By tigger in forum Administrators
    Replies: 0
    Last Post: 05-23-2007, 03:26 AM
  4. Replies: 2
    Last Post: 07-20-2006, 10: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
  •