使用Google通讯录api获取群组联系

时间:2017-05-11 07:34:44

标签: google-api-php-client google-contacts

我已经按照指示操​​作了 see here用于群组数据。

但每当我尝试使用https://developers.google.com/google-apps/contacts/v3/#retrieving_a_single_contact_group获取分组智能数据时,我只获得给定数组中的组ID,而不是其他数据(如名称,手机号码)。

下面给出了一个给定的数组,以便更好地理解

[0] => Array
    (
        [gd$etag] => "YDwreyM."
        [id] => Array
            (
                [$t] => http://www.google.com/m8/feeds/groups/rahmanarafat13%40gmail.com/base/6
            )

        [updated] => Array
            (
                [$t] => 1970-01-01T00:00:00.000Z
            )

        [category] => Array
            (
                [0] => Array
                    (
                        [scheme] => http://schemas.google.com/g/2005#kind
                        [term] => http://schemas.google.com/contact/2008#group
                    )

            )

        [title] => Array
            (
                [$t] => System Group: My Contacts
            )

        [content] => Array
            (
                [$t] => System Group: My Contacts
            )

        [link] => Array
            (
                [0] => Array
                    (
                        [rel] => self
                        [type] => application/atom+xml
                        [href] => https://www.google.com/m8/feeds/groups/rahmanarafat13%40gmail.com/full/6?v=3.0
                    )

            )

        [gContact$systemGroup] => Array
            (
                [id] => Contacts
            )

    )

请勿获取['gd $ name']或['gd $ phoneNumbe']等其他值。

我现在该怎么办?

如有任何疑问,请在评论中提问

1 个答案:

答案 0 :(得分:0)

最好将联系人群体视为“标签”。它们只是联系人上存在的属性。从API中获取组只会告诉您有关该标签的元数据信息(基本上只是它的名称),而不是恰好应用该标签的联系人。

如果要获取组中的联系人,请将group filter参数与联系人列表端点一起使用。 查看https://developers.google.com/google-apps/contacts/v3/#retrieving_contacts_using_query_parameters他们在哪里获取与updated-min的联系人。只需将updated-min更改为group,然后将值设置为组ID,如https://developers.google.com/google-apps/contacts/v3/reference#Parameters

所示