google-contacts-api

How to create Google Contact using Google API


I am trying to create Google Contact using Google Contacts API. According to Google doc(as below), I have already implement the create function.

Google Docs Creating contacts

To create a new contact, send an authorized POST request to the user's contacts feed URL with contact data in the body. The URL is of the form:

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

I use this query to create a contact:

  www.google.com/m8/feeds/contacts/{userEmail}/full 

However, the new contact is created in the group "Other Contact" by default.

How can I directly create in the group "My Contact"?

Do I need to modify the query?


Solution

  • From the doc (https://developers.google.com/google-apps/contacts/v3/?csw=1#authorizing_requests_to_the_api_name_service):

    Contact Group Entry

    Contacts can be placed into user-defined groups. You can create, retrieve, update, and delete these groups using the Contacts Data API, and you can add contacts to a group or remove contacts from a group. For details, see the following sections.

    The Contacts Data API also provides access to four predefined "system groups" for each user:

    My Contacts Friends Family Coworkers System groups appear in a groups feed just like user-defined groups do. In fact, system groups are mostly treated just like other groups. The differences are:

    Each system group entry contains a subelement. The id attribute of that subelement indicates which system group the group is: Contacts, Friends, Family, or Coworkers. Note that the My Contacts ID value is simply Contacts, without the "My". Also note that this system group ID value is different from the group ID given in the group entry's element. You can't add new system groups, change the name of a system group, add extended properties to a system group, or delete a system group. * The contact-group entry representing a system group doesn't contain a rel="edit" link.