0
votes

I have created contacts using google contacts POST API. and I am successfully able to fetch them using GET API. Reference.

Now, Logged into the same google account from an android device and successfully synced contacts but the contacts which are created using POST API are not imported in sync.

Note:

  1. Contacts Created from Android are fetched Successfully using GET API from Web-Client.
  2. Contacts Deleted using Delete API are successfully deleted from android device on sync ( both contacts which are created using api or android) and vice-versa.

Can anyone help me by telling how to resolve this issue. Thanks in advance.

1
Check the below settings. Go to Settings>Accounts-Google>[your account]. Is Contacts checked on? Also, open the Contacts app, tap Menu>Settings>Contacts to Display , and make sure it's set to All.Santhosh
yes santhosh, both of these are already correct. and sync is also successful.Abdus Sattar
let me explain with example. suppose I have created 3 contacts using POST API. and another 5 contacts from android itself. the GET API is giving all 8 contacts. now, i logged into same google account from another device here I am only getting 5 contacts(created from android).but other 3 contacts created from POST API are not synced.Abdus Sattar
Can you see them on Google Contacts ?Santhosh
No santhosh. contacts created using POST are not coming.Abdus Sattar

1 Answers

0
votes

You have to add the gContact:groupMembershipInfo field in your XML request body while creating contacts in order to create contacts in My Contacts.

Add the following in your POST request

<gContact:groupMembershipInfo deleted="false" 
href="http://www.google.com/m8/feeds/groups/userEmail/base/groupId"/>

where groupId is 6 for My Contacts.

You can get the GroupId for all the groups by sending an authorized GET request to the contact groups feed URL

https://www.google.com/m8/feeds/groups/{userEmail}/full

This request wil give the detail of the Groups.

Refer this for more information Retrieving_all_contact_groups