How do you get from Person to ContactEntry

2019-08-19 02:29发布

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条回答
ゆ 、 Hurt°
2楼-- · 2019-08-19 03:06

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.

查看更多
登录 后发表回答