Create shared contacts

After setting up authentication , you can use the Domain Shared Contacts API to publish new shared contact entries to a Google Workspace domain. Shared contacts can take up to 24 hours to appear in the email address autocomplete and the contact manager.

  1. Create an XML representation of the shared contact that you want to publish in the form of an Atom <entry> element of the Contact kind , which might look similar to the following:

    <atom:entry  
    xmlns:atom='http://www.w3.org/2005/Atom'  
    xmlns:gd='http://schemas.google.com/g/2005'>  
    <atom:category  
    scheme='http://schemas.google.com/g/2005#kind'  
    term='http://schemas.google.com/contact/2008#contact'  
    />  
    <gd:name>  
    <gd:givenName> FIRST_NAME 
    </gd:givenName>  
    <gd:familyName> LAST_NAME 
    </gd:familyName>  
    <gd:fullName> FIRST_NAME 
      
     LAST_NAME 
    </gd:fullName>  
    </gd:name>  
    <atom:content  
    type='text'>NOTES</atom:content>  
    <gd:email  
    rel='http://schemas.google.com/g/2005#work'  
    primary='true'  
    address=' PRIMARY_EMAIL_ADDRESS 
    '  
    displayName=' PREFERRED_NAME 
    '  
    />  
    <gd:email  
    rel='http://schemas.google.com/g/2005#home'  
    address=' SECONDARY_EMAIL_ADDRESS 
    '  
    />  
    <gd:phoneNumber  
    rel='http://schemas.google.com/g/2005#work'  
    primary='true'>  
     PRIMARY_PHONE_NUMBER 
      
    </gd:phoneNumber>  
    <gd:phoneNumber  
    rel='http://schemas.google.com/g/2005#home'>  
     SECONDARY_PHONE_NUMBER 
      
    </gd:phoneNumber>  
    <gd:im  
    address=' INSTANT_MESSAGING_ADDRESS 
    '  
    protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'  
    primary='true'  
    rel='http://schemas.google.com/g/2005#home'  
    />  
    <gd:structuredPostalAddress  
    rel='http://schemas.google.com/g/2005#work'  
    primary='true'>  
    <gd:city> CITY_NAME 
    </gd:city>  
    <gd:street> ADDRESS 
    </gd:street>  
    <gd:region> REGION_NAME 
    </gd:region>  
    <gd:postcode> POST_CODE 
    </gd:postcode>  
    <gd:country> COUNTRY_NAME 
    </gd:country>  
    <gd:formattedAddress>  
     FORMATTED_ADDRESS 
      
    </gd:formattedAddress>  
    </gd:structuredPostalAddress>
    </atom:entry>

    Replace the following:

    • FIRST_NAME : First name of the shared contact—for example, Alex.
    • LAST_NAME : The last name of the shared contact—for example, Kim.
    • PRIMARY_EMAIL_ADDRESS : The preferred email address of the shared contact—for example, alk@gmail.com.
    • PREFERRED_NAME : The name that is displayed for the user—for example, Alex Kim
    • SECONDARY_EMAIL_ADDRESS : Another email address for the shared contact—for example, alk@example.org.
    • PRIMARY_PHONE_NUMBER : The preferred phone number for the shared contact—for example, (800) 555-0100.
    • SECONDARY_PHONE_NUMBER : Another phone number for the shared contact—for example, (800) 555-0101.
    • INSTANT_MESSAGING_ADDRESS : The email address associated with the shared contact's instant messaging information—for example, alk@gmail.com.
    • CITY_NAME : The city name for the shared contact—for example, Mountain View.
    • ADDRESS : The street address for the shared contact—for example, 1600 Amphibious Blvd.
    • REGION_NAME : The state or province for the shared contact—for example, CA.
    • POST_CODE : The ZIP or postal code for the shared contact—for example, 94045.
    • COUNTRY_NAME : The country for the shared contact—for example, United States.
    • FORMATTED_ADDRESS : The address of the shared contact that is formatted using the convention of their country or region—for example,1800 Amphibious Blvd Mountain View.
  2. To publish this entry, send it to the contact-list feed URL:

    1. Place your Atom <entry> element in the body of a new POST request by using the application/atom+xml content type.
    2. Send the POST request to the feed URL.

    For example, to add a domain shared contact to the list belonging to example.com, send the POST request with the new entry to the following URL:

     https://www.google.com/m8/feeds/contacts/example.com/full 
    

    The Google server creates a contact by using the entry that you sent, then returns an HTTP 201 CREATED status code, along with a copy of the new contact in the form of an <entry> element. The entry returned is the same one that you sent, but it also contains various elements added by the server, such as an <id> element.

    If your request fails, Google might return a different status code. For information about the status codes, see the Google Data API protocol reference document .

Next steps

Create a Mobile Website
View Site in Mobile | Classic
Share by: