duplicate contacts

175 views
Skip to first unread message

Zindus Development

unread,
Jul 20, 2008, 7:10:10 PM7/20/08
to Google Contacts API
Hi -

If a user has duplicate contacts in their Google Contacts, does this
point to:
a) a bug in the API. If so, how to report it?
b) some historical legacy whereby the no-duplicate rule wasn't
always enforced
c) some other reason - eg the no-duplicate rule is enforced for some
clients but not others.

The Google Contacts API serving duplicates to a client seems to violate
the rule of
"be conservative in what you do, be liberal in what you accept
from others"
because the API is serving data to clients that it won't accept in return.

The second part of the question is to invite suggestions on how this
state of affairs should be handled from a client perspective? eg. if
the cause is a) or b) above then perhaps it makes sense to clean up the
duplicates but if it's c) then perhaps it's better to live with them.

Thanks.

Leni.

Sebastian Adamczyk

unread,
Jul 21, 2008, 6:28:26 AM7/21/08
to Google Contacts API
Hi,

Can you elaborate more on what you mean by duplicate contacts? Right
now you can have multiple contacts with the same name since it is
likely for people to have such contacts (I personally know two people
that have the same first and the last name). However there is a
constraint that two different contacts can't share an email address.
Basically it is very hard to say if a contact is a duplicate of
another contact. Having the same name, email, address or whatever for
two different contacts does not guarantee that these are duplicates so
we have decided that we will not add constraints that might be
unacceptable for many clients.

Regards,
Sebastian

Zindus Development

unread,
Jul 21, 2008, 8:13:44 PM7/21/08
to google-co...@googlegroups.com
Sebastian Adamczyk wrote:
> Can you elaborate more on what you mean by duplicate contacts?

Sure. Here is an <entry>:

<entry>
<id>http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1</id>
<updated>2008-07-11T00:00:00.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact'/>
<title type='text'>Fred Bloggs</title>
<link rel='self' type='application/atom+xml'
href='http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1'/>
<link rel='edit' type='application/atom+xml'
href='http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1/11'/>
<gd:email rel='http://schemas.google.com/g/2005#home'
address='fred....@example.com' primary='true'/>
</entry>

The use-case is the server responding to a GET with a <feed> containing
two <entry>'s identical to the one above except for different <id> and
<updated> elements.

Unless I have misunderstood, it seems reasonable to describe the
<entry>'s as duplicates?

> Basically it is very hard to say if a contact is a duplicate of
> another contact.

It's important to be clear about the rules around conflicts. You have
explained it in the same way as:
http://code.google.com/apis/contacts/developers_guide_protocol.html#Creating
so that's reassuring.

So can I ask again:
- does the <feed> described above represent a server/constraint failure?
If so, that's cool - the intent is not to point the finger, just to be
clear about the rules around conflicts
- any suggestions re: how clients should handle such a <feed>?

Leni.

Sebastian Adamczyk

unread,
Jul 22, 2008, 7:12:14 AM7/22/08
to Google Contacts API
Hi,

From what you said it seems that you have two entries that are
identical but have different ids. This means two different contacts
that are identical. Am I right?
I can see that your entry has an email set. If you are talking about
two different contacts that have the same email this might be a server
problem.
Is it possible for you to provide information about your account
(preferably to my corporate email: sada...@google.com) so that I can
check if this is really a server problem (email address would be
enough, don't provide me with your password).

Regards,
Sebastian

On Jul 22, 2:13 am, Zindus Development <google....@zindus.com> wrote:
> Sebastian Adamczyk wrote:
> > Can you elaborate more on what you mean by duplicate contacts?
>
> Sure. Here is an <entry>:
>
> <entry>
> <id>http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1</id>
> <updated>2008-07-11T00:00:00.000Z</updated>
> <category scheme='http://schemas.google.com/g/2005#kind'
> term='http://schemas.google.com/contact/2008#contact'/>
> <title type='text'>Fred Bloggs</title>
> <link rel='self' type='application/atom+xml'
> href='http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1'/>
> <link rel='edit' type='application/atom+xml'
> href='http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/1/11'/>
> <gd:email rel='http://schemas.google.com/g/2005#home'
> address='fred.blo...@example.com' primary='true'/>
> </entry>
>
> The use-case is the server responding to a GET with a <feed> containing
> two <entry>'s identical to the one above except for different <id> and
> <updated> elements.
>
> Unless I have misunderstood, it seems reasonable to describe the
> <entry>'s as duplicates?
>
> > Basically it is very hard to say if a contact is a duplicate of
> > another contact.
>
> It's important to be clear about the rules around conflicts. You have
> explained it in the same way as:http://code.google.com/apis/contacts/developers_guide_protocol.html#C...

Wayne

unread,
Jul 23, 2008, 11:28:39 PM7/23/08
to Google Contacts API
Hi

Does gmail or contacts API enforce that no two contacts have the same
email address?
What is the exact condition for two entries to be considered
identical?

I am working with a client that does not have this constraint. For
example, an email alias may be used by support or administrative
group. e.g,
h...@example.com could be used by Jenny and Fenny.

Wayne

On Jul 22, 4:12 am, Sebastian Adamczyk <sadamc...@google.com> wrote:
> Hi,
>
> From what you said it seems that you have two entries that are
> identical but have different ids. This means two different contacts
> that are identical. Am I right?
> I can see that your entry has an email set. If you are talking about
> two different contacts that have the same email this might be a server
> problem.
> Is it possible for you to provide information about your account
> (preferably to my corporate email: sadamc...@google.com) so that I can

Trevor Johns

unread,
Jul 24, 2008, 4:31:10 AM7/24/08
to google-co...@googlegroups.com
On Wed, Jul 23, 2008 at 8:28 PM, Wayne <wsh...@gmail.com> wrote:
>
> Hi
>
> Does gmail or contacts API enforce that no two contacts have the same
> email address?
> What is the exact condition for two entries to be considered
> identical?
>
> I am working with a client that does not have this constraint. For
> example, an email alias may be used by support or administrative
> group. e.g,
> h...@example.com could be used by Jenny and Fenny.
>
> Wayne

Hi Wayne,
The criteria for two contacts to be considered identical is that they
have the same email address. This is (or at least should be) enforced
by both GMail and the Contacts API.

In GMail, you'll get the following error:

Error saving data: Cannot have more than one contact with email
address 'te...@example.com'.

In the Contacts API, you'll get an HTTP 409 Conflict status after
submitting the entry.

As for having multiple contacts with the same email address, that's
not currently supported. If that's something you'd like to see added,
please file a feature request here:

http://code.google.com/p/gdata-issues/issues/entry

Regarding creating duplicate contacts on the iPhone, that's
interesting. The OS X sync client uses the exact same Contacts API
everybody else uses. However, I know that there were some earlier bugs
in the API that would permit this under certain circumstances, it's
possible the duplicate was created via one of these bugs before they
were fixed.

--
Trevor Johns

Zindus Development

unread,
Aug 8, 2008, 7:13:39 PM8/8/08
to google-co...@googlegroups.com
There are two separate issues here:
1. how duplicate contacts were (are being) created
in violation of the (supposed) constraint:
http://code.google.com/apis/contacts/developers_guide_protocol.html#Creating

2. what to do when duplicates exist in an account?

My question relates to (2). What should client software do when it is
presented duplicates by the Contacts API?

The trouble is that client software won't be able to edit duplicate
contacts via the API because when it tries to update one of the
duplicates it'll get a 409. So what to do?

And a related question - does Gmail itself use the Contacts API? I am
wondering how a user with duplicate contacts in their account is able to
happily edit their contacts via Gmail?

Regards -

Leni.

Trevor Johns

unread,
Aug 13, 2008, 4:27:01 PM8/13/08
to google-co...@googlegroups.com

Hi Leni,
Sorry for the delay in replying.

To answer your questions:

1. The duplicate contacts are created due to a race condition in our
code. To put it simply, the constraint is enforced at the application
level, not a the storage level. If two of our servers perform an
insert/update at the same time, they may not see the other's changes.
This is how the constraint is being violated.

That being said, this is not a good thing. Even though it's possible
to violate the constraint, there are issues with various services that
can arise because of this. This is a known issue, and we're working on
it.

2. Unfortunately, there's no good solution to this at the moment.
You'll have to manually merge the contacts (I believe that you should
be able to change the email address for one of the contacts to resolve
the conflict -- however, I don't have an account with duplicate
entries to check with, so I could be wrong), or ask the user to do
this themselves via the GMail interface.

GMail does not use the Contacts API. Instead, it ties directly into
the contacts system. As a result, the validation logic can yield
different results on edge cases such as this.

--
Trevor Johns

Trevor Johns

unread,
Aug 13, 2008, 6:20:28 PM8/13/08
to google-co...@googlegroups.com
On Wed, Aug 13, 2008 at 1:27 PM, Trevor Johns <tjo...@google.com> wrote:
> 1. The duplicate contacts are created due to a race condition in our
> code. To put it simply, the constraint is enforced at the application
> level, not a the storage level. If two of our servers perform an
> insert/update at the same time, they may not see the other's changes.
> This is how the constraint is being violated.
>
> That being said, this is not a good thing. Even though it's possible
> to violate the constraint, there are issues with various services that
> can arise because of this. This is a known issue, and we're working on
> it.

Though, just to be clear: Please don't write any code that depends on
the existence of the email uniqueness constraint. It's considered to
be a limitation of API and may be removed in a future update to API.

--
Trevor Johns

Reply all
Reply to author
Forward
0 new messages