代码之家  ›  专栏  ›  技术社区  ›  Joril

SuiteCRM:使用API V8获取帐户电子邮件地址

  •  1
  • Joril  · 技术社区  · 6 年前

    我正在尝试使用新的JSONV8API获取与特定帐户关联的电子邮件地址。

    我可以获取我的访问令牌并使用它来获取帐户,现在我也要获取它的电子邮件地址(我知道这个特定的帐户有两个电子邮件地址)。

    我试过打电话给 api/v8/modules/Accounts/{ACCOUNTID}/relationships/email_addresses Endpoint,这是我收到的数据:

    [{'id': '1ee15ac7-18d3-96d7-035d-5b3f3c3dba94',
      'links': {'href': 'http://devcrm/api/v8/modules/Accounts/1ee15ac7-18d3-96d7-035d-5b3f3c3dba94'},
      'meta': {'middle_table': {'data': {'attributes': {'bean_id': 'a5ec312f-b1dc-d401-d3be-5b23b3058722',
                                                            'bean_module': 'Accounts',
                                                            'date_created': '2018-07-06 09:53:48',
                                                            'date_modified': '2018-07-06 09:53:48',
                                                            'deleted': '0',
                                                            'email_address_id': '1ee15ac7-18d3-96d7-035d-5b3f3c3dba94',
                                                            'id': '1ee15ac7-18d3-96d7-035d-5b3f3c3dba94',
                                                            'primary_address': '0',
                                                            'reply_to_address': '0'},
                                            'id': '',
                                            'type': 'Link'}}},
      'type': 'EmailAddresses'},
     {'id': '8f42881c-d788-9a69-15b3-5b3f3be9705f',
      'links': {'href': 'http://devcrm/api/v8/modules/Accounts/8f42881c-d788-9a69-15b3-5b3f3be9705f'},
      'meta': {'middle_table': {'data': {'attributes': {'bean_id': 'a5ec312f-b1dc-d401-d3be-5b23b3058722',
                                                            'bean_module': 'Accounts',
                                                            'date_created': '2018-07-06 09:49:13',
                                                            'date_modified': '2018-07-06 09:49:13',
                                                            'deleted': '0',
                                                            'email_address_id': '8f42881c-d788-9a69-15b3-5b3f3be9705f',
                                                            'id': '8f42881c-d788-9a69-15b3-5b3f3be9705f',
                                                            'primary_address': '0',
                                                            'reply_to_address': '0'},
                                            'id': '',
                                            'type': 'Link'}}},
      'type': 'EmailAddresses'}]
    

    如您所见,有两个“分支”,每个电子邮件地址一个,但实际地址(x@y.com)不见了,只有 email_address_id 这是正常的吗?我应该使用 电子邮件地址 s再次呼叫服务器?但我不确定我应该反对哪个模块。

    1 回复  |  直到 6 年前
        1
  •  1
  •   Joril    6 年前

    看起来要使用的模块是“emailAddresses”,因此在本例中:
    GET api/v8/modules/EmailAddresses/1ee15ac7-18d3-96d7-035d-5b3f3c3dba94
    GET api/v8/modules/EmailAddresses/8f42881c-d788-9a69-15b3-5b3f3be9705f