Reputation: 1729
When I issue a contacts request to get all of a user's contacts I get contacts Id's of the form:
http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b
Reading the google contacts api 3.0 I was a bit confused on what uri should I use to delete a contact. Doing:
var cr = new ContactsRequest(settings);
var uri = new Uri("http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b");
var contact = cr.Retrieve<Contact>(uri);
cr.Delete(contact);
fails with
Google.GData.Client.GDataRequestException : Execution of request returned unexpected result: http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b?max-results=50MovedPermanently
What's the correct way to get a contact Id and request for a contact deletion? Thanks in advance.
Upvotes: 2
Views: 1046
Reputation: 1729
I did some research on this and I found 2 errors.
1) I got a "Moved permanently because I issued my request in http and I should have done that in https.
2) The uri format is strictly :
https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
I had a setting.Pagesize = 50
, which caused my uri to be
https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}?max-results=50
which is invalid and returns a 400 bad request.
The contact Id is the hash code that you get from the contact.Id result uri. After you retrieve the contact entry, the deletion is as documented in the google api contacts v3.0 .
Upvotes: 1