CRM Contacts Read¶
API CRM Contacts is used to read the contact list in CRM
API URL¶
https://[YOUR-PBX-URL]/api/crm-contacts
The data is transmitted by POST or GET and must be of the form:¶
Array
(
[action] => read
[page] => 1
[filters] => Array
(
[project_id] =>
[crm_type_id] =>
[search] =>
[status] =>
)
[api_hash] => 07112231a9c89f5b108af08608a97b07
)
The action parameter must be read. The page parameter is default 1, it will need to be incremented to extract data from all pages.
Headere HTTP:¶
Content-Type: text/xml Authorization: Bearer <token>
Filters:¶
- project_id: project ID in PBX
- crm_type_id: ID CRM Type in PBX
- search: Search by phone number, ID or name
- status: Contact Status
Example of parameter generation:
$params = array(
'action' => 'read',
'page' => 1,
'filters' => array(
'project_id' => null,
'crm_type_id' => null,
'search' => null,
'status' => 'valid', // -1 = All
)
);
Example of hash generation:
$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash
Example for sending data::
$url = 'https://[YOUR-PBX-URL]/api/crm-contacts';
$token = 'your_api_token';
echo curlPost($url, http_build_query($params), array("Authorization: Bearer {$token}"));
Answear¶
If successful:
{
"has_error": false,
"messages": [ ],
"pagination": {
"row_count": 0,
"page_size": 100,
"current_page": 0,
"max_page": 0
},
"results": [
{
"id": "3",
"project_id": "1",
"name": "John Doe",
"crm_type_id": "1",
"title": null,
"company": null,
"avatar": null,
"email": null,
"website": null,
"address": null,
"queue_position": null,
"direct_line": null,
"skip_welcome": null,
"skip_enter_queue": null,
"monitor_option": null,
"language": "ro",
"we_are_recording_message": "asdasda",
"assigned_user_id": null,
"comments": null,
"created": "2018-01-04 13:39:26",
"start_date": null,
"end_date": null,
"call_parameters": null,
"source_uniqueid": null,
"source_inbound_route_id": null,
"added_by": null,
"parser_id": null,
"parser_md5": null,
"remote_id": null,
"purge_date": null,
"status": "active",
"telephones": [
"0712345678"
],
"added_by_name": null,
"assigned_user_name": null,
"assigned_user_email": null,
"parser_name": null,
"project_name": "While1"
}
]
}
}
Or in case of error:
{
"has_error": true,
"messages": [
"Invalid filter: project_idxx"
],
"pagination": [ ],
"results": [ ]
}
Available in other languages: RO