-->

How do you get from Person to ContactEntry

2019-08-19 02:53发布

问题:

As far as I know it is not possible (yet) to update photos linked to Person (People API), and it is advised to achieve this using the Contact API.

But how does one get from Person to ContactEntry?

I tried to concatenate Person's resourceName to "https://www.google.com/m8/feeds/contacts/default/full/" but I am getting "ResourceNotFoundException" errors.

回答1:

When you get a person with a contact in them, the person will look like:

{
  metadata: {
    sources: [
      {
        type: PROFILE,
        id: "12345678"
      },
      {
        type: CONTACT,
        id: "abc123"
      }
    ]
  }
}

You should find the metadata.sources field with type CONTACT, then you can use the id of that contact in the contacts API. GET https://www.google.com/m8/feeds/contacts/default/full/<id> should return the contact data.