【问题标题】:Fetch group wise contact using Google contacts api使用 Google 联系人 API 获取群组联系人
【发布时间】:2017-05-11 07:34:43
【问题描述】:

我已经按照 https://developers.google.com/google-apps/contacts/v3/#retrieving_a_single_contact_group 用于组数据。

但每当我尝试使用 https://www.google.com/m8/feeds/groups/default/full 获取分组数据时,我只得到了给定数组中的组 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']。

我现在该怎么办?

如有疑问请在评论中提问

【问题讨论】:

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


    【解决方案1】:

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

    如果您想获取组中的联系人,请将组过滤器参数与联系人列表端点一起使用。 请参阅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 所示

    【讨论】:

    • 不,@Blake 它不起作用。你的意思是这样做google.com/m8/feeds/contacts/default/full?group=office 其中 group 替换为 updated-min 并且 office 是我的 group(label) id 值
    • 组 ID 是完整的原子样式 ID,例如"http://www.google.com/m8/feeds/groups/you@gmail.com/base/2387528937582759825892758"
    • yap @Blake 我昨天收到了。谢谢.. :)
    猜你喜欢
    • 2022-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多