smarkio / smarkio-api-client
与 Smark.io 内部 API 通信的加速器
2.0.0
2015-08-20 13:32 UTC
Requires
- guzzle/guzzle: ~3.7
This package is not auto-updated.
Last update: 2024-09-28 15:39:26 UTC
README
用于管理潜在客户关系的 © Smark.io API 通信加速器
使用 Composer 安装和配置
将以下内容添加到您的 composer.json 文件中,以获取项目的最新稳定版本
{ "require": { "smarkio/smarkio-api-client": "*" } }
然后,为了在您的 PHP 文件中使用此加速器,请添加以下内容
require '[COMPOSER_VENDOR_PATH]/autoload.php';
内容
- src/Smarkio/API - 与 Smarkio 内部 API 交互的代码。
- examples/ - 一些使用此加速器的示例。
开始之前
您需要获得一个 API 令牌才能使用 API。此令牌绑定到 Smark.io 系统的每个用户详细信息。
使用方法
创建潜在客户关系
$api_token = 'YOUR API TOKEN HERE'; $my_smarkio_url = 'YOUR SMARK.IO URL HERE'; //The ID of the first lead of the relation $originId = '359680'; //The ID of the second lead of the relation $destinyId = '359670'; //Slug of the relation type $type = 'family'; //Operation of the API, in this case to create a Lead Relation $operation = 'add'; // create Relation $relation = new Relation($originId, $destinyId, $type, $api_token); // send the request $response = $relation->send($operation,$my_smarkio_url);
删除潜在客户关系
$api_token = 'YOUR API TOKEN HERE'; $my_smarkio_url = 'YOUR SMARK.IO URL HERE'; //The ID of the first lead of the relation $originId = '359680'; //The ID of the second lead of the relation $destinyId = '359670'; //Slug of the relation type $type = 'family'; //Operation of the API, in this case to delete a Lead Relation $operation = 'delete'; // create Relation $relation = new Relation($originId, $destinyId, $type, $api_token); // send the request $response = $relation->send($operation,$my_smarkio_url);
通过 ID 获取潜在客户
$api_token = 'YOUR API TOKEN HERE'; $my_smarkio_url = 'YOUR SMARK.IO URL HERE'; // The id of the lead $my_lead_id = 36; $lead_api = new \Smarkio\API\LeadAPI($api_token, $my_smarkio_url); $lead = $lead_api->getLead($my_lead_id);
搜索潜在客户
$api_token = 'YOUR API TOKEN HERE'; $my_smarkio_url = 'YOUR SMARK.IO URL HERE'; $lead_api = new \Smarkio\API\LeadAPI($api_token, $my_smarkio_url); // Parameters to filter the Search // If null use defaults $parameters = array( 'id_min' => null, // eg: 123 'id_max' => null, // eg: 999 'creation_date_min' => null, // eg: '2015-07-01' 'creation_date_max' => null, // eg: '2015-07-31' 'integration_date_min' => null, // eg: '2015-07-01' 'integration_date_max' => null, // eg: '2015-07-31' 'limit' => null, // eg: 100 'offset' => null // eg: 0 ) // Get the paginated results $paginated_leads = $lead_api->searchLead($parameters); $continue_processing = true; // Get all the pages while ($continue_processing) { $leads = $paginated_leads->getLeads(); // Do something with the leads ... $continue_processing = $paginated_leads->hasNext(); if ( $continue_processing ) { // Get the next results $paginated_leads = $paginated_leads->next(); } }