0

How do I specify custom fields while creating/updating a contact with the API (also retrieving it)? I'm using the Python API.

systempuntoout
  • 71,966
  • 47
  • 171
  • 241
john2x
  • 22,546
  • 16
  • 57
  • 95

1 Answers1

0
import gdata.contacts.data

new_contact = gdata.contacts.data.ContactEntry()

# Set the contact's name.
new_contact.name = gdata.data.Name(
    given_name=gdata.data.GivenName(text='Elizabeth'),
    family_name=gdata.data.FamilyName(text='Bennet'),
    full_name=gdata.data.FullName(text='Elizabeth Bennet')
)

# Set user defined fields
new_contact.user_defined_field.append(
    gdata.contacts.data.UserDefinedField(
        key='Field Name',
        value='Field Value'
    )
)
john2x
  • 22,546
  • 16
  • 57
  • 95