SugarCRM call records REST API

雨燕双飞 提交于 2020-01-15 12:14:35

问题


I am trying to get the call records from my SugarCRM account using the REST API and I am using Python. There I want to obtain all the attendees but all I get is the user to whom the call is assigned.

u'assigned_user_id': u'xxxxxxxx',

The response I've received is,

  • {u'created_by_link': {u'id': u'1', u'full_name': u'adminx', u'_acl': {u'fields': {u'last_login': {u'write': u'no', u'create': u'no'}, u'pwd_last_changed': {u'write': u'no', u'create': u'no'}}, u'_hash': u'xxxx', u'delete': u'no'}}, u'dri_workflow_task_template_link': {u'_acl': {u'fields': [], u'_hash': u'xxxx'}, u'name': u'', u'id': u''},

  • u'customer_journey_points': 10,

  • u'dri_subworkflow_id': u'',
  • u'recurrence_id': u'',
  • u'created_by_name': u'adminx',
  • u'date_end': u'2018-05-02T09:45:00+00:00',
  • u'dri_subworkflow_template_id': u'',
  • u'parent_type': u'Accounts',
  • u'contact_id': u'xxxx',
  • u'_acl': {u'fields': {}},
  • u'duration_minutes': 30,
  • u'tag': [],
  • u'assigned_user_name': u'xxxx',
  • u'repeat_ordinal': u'',
  • u'repeat_count': None,
  • u'contact_name': u'xxxx',
  • u'repeat_interval': 1, u'id': u'xxxx', > - u'parent_name': u'ABC',
  • u'customer_journey_parent_activity_id': u'',
  • u'date_entered': u'2017-07-17T12:49:23+00:00',
  • u'outlook_id': u'',
  • u'team_name': [{u'name_2': u'', u'selected': False, u'primary': True, u'id': u'1', u'name': u'Global'}, {u'name_2': u'', u'selected': False, u'primary': False, u'id': u'West', u'name': u'West'}],

  • u'contacts': {u'_acl': {u'fields': [], u'_hash': u'xxxx'}, u'name': u'xxx', u'id': u'xxx'},

  • u'dri_workflow_task_template_id': u'',
  • u'customer_journey_score': None,
  • u'date_start': u'2018-05-02T09:15:00+00:00',
  • u'reminder_checked': u'',
  • u'dri_workflow_sort_order': u'1',
  • u'created_by': u'1',
  • u'parent_id': u'xxxx',
  • u'dri_subworkflow_template_link': {u'_acl': {u'fields': [], u'_hash': u'xxxx'}, u'name': u'', u'id': u''},

  • u'dri_subworkflow_name': u'',

  • u'dri_subworkflow_link': {u'_acl': {u'fields': [], u'_hash': u'xxxx'}, u'name': u'', u'id': u''},

  • u'modified_by_name': u'adminx',

  • u'repeat_selector': u'',
  • u'email_reminder_sent': False,
  • u'dri_workflow_template_id': u'',
  • u'status': u'Not Held',
  • u'direction': u'Outbound',
  • u'accept_status_users': u'',
  • u'repeat_dow': u'',
  • u'description': u'',
  • u'parent': {u'type': u'Accounts', u'_acl': {u'fields': [], u'_hash': u'xxxx'}, u'name': u'XYZ Funding Inc', u'id': u'xxxx'},

  • u'repeat_unit': u'',

  • u'deleted': False,
  • u'is_customer_journey_parent_activity': False,
  • u'customer_journey_parent_activity_type': u'',
  • u'locked_fields': [],
  • u'email_reminder_time': -1,
  • u'following': False,
  • u'assigned_user_link': {u'id': u'xxxx', u'full_name': u'xxxx', u'_acl': {u'fields': [], u'_hash': u'xxxx'}},

  • u'repeat_type': u'',

  • u'assigned_user_id': u'seed_sally_id',
  • u'team_count_link': {u'team_count': u'', u'id': u'1', u'_acl': {u'fields': [], u'_hash': u'xxxx'}},
  • u'dri_workflow_task_template_name': u'',
  • u'modified_user_link': {u'id': u'1', u'full_name': u'adminx', u'_acl': {u'fields': {u'last_login': {u'write': u'no', u'create': u'no'}, u'pwd_last_changed': {u'write': u'no', u'create': u'no'}}, u'_hash': u'xxx', u'delete': u'no'}},

  • u'email_reminder_checked': u'',

  • u'_module': u'Calls',
  • u'modified_user_id': u'1',
  • u'repeat_until': u'',
  • u'name': u'test',
  • u'date_modified': u'2017-07-17T12:49:23+00:00',
  • u'accept_status': u'',
  • u'reminder_time': -1,
  • u'customer_journey_progress': 0,
  • u'dri_workflow_template_name': u'',
  • u'my_favorite': False,
  • u'dri_subworkflow_template_name': u'',
  • u'dri_workflow_template_link': {u'_acl': {u'fields': [], u'_hash': u'xxx'}, u'name': u'', u'id': u''}, > - u'set_accept_links': u'',
  • u'repeat_days': u'',
  • u'is_customer_journey_activity': False,
  • u'repeat_parent_id': u'',
  • u'team_count': u'',
  • u'duration_hours': 0,
  • u'recurring_source': u''},

回答1:


Strangely, the object which contains the list of "Guests" is not present in the standard GET request i.e.

https://{INSTANCE}/rest/v10/Calls/{RECORD_ID}

After doing some troubleshooting, and looking at the model in the web application itself, I found that the "Guests" field in the GUI ties back to a model property called "invitees".

Running a web request specifically referencing this field provides you with an array of records linked to the Call ID. So try running a GET request to this endpoint:

https://{INSTANCE}/rest/v10/Calls/{RECORD_ID}?fields=invitees

This should provide you with JSON akin to the below:

{
    "id": "ec041f60-72b1-11e7-89f0-00163ef1f82f",
    "date_modified": "2017-08-08T12:26:47+00:00",
    "invitees": {
        "records": [
            {
                "id": "cf378211-2b38-4fe5-949b-a53040717f04",
                "date_modified": "2017-08-01T16:12:48+00:00",
                "_acl": {
                    "fields": {}
                },
                "_module": "Users",
                "_link": "users"
            },
            {
                "id": "fe1740e6-3fa4-11e7-8fef-00163ef1f82f",
                "date_modified": "2017-05-23T10:45:52+00:00",
                "_acl": {
                    "fields": {}
                },
                "_module": "Contacts",
                "_link": "contacts"
            },
            {
                "id": "dcc526fc-72b1-11e7-a6dd-00163ef1f82f",
                "date_modified": "2017-07-27T09:57:21+00:00",
                "_acl": {
                    "fields": {}
                },
                "_module": "Leads",
                "_link": "leads"
            },
            {
                "id": "89f8a6d1-7df0-0e0b-3568-58a5bb6ecf34",
                "date_modified": "2017-04-06T10:36:16+00:00",
                "_acl": {
                    "fields": {}
                },
                "_module": "Leads",
                "_link": "leads"
            }
        ],
        "next_offset": {
            "contacts": -1,
            "leads": -1,
            "users": -1
        }
    },
    "_acl": {
        "fields": {}
    },
    "contact_name": "test",
    "_module": "Calls"
}


来源:https://stackoverflow.com/questions/45567081/sugarcrm-call-records-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!