smarkio / smarkio-revisor-api-client
Smarkio 反馈 API 的通信加速器
1.1.0
2017-04-03 10:43 UTC
This package is not auto-updated.
Last update: 2024-09-28 16:10:16 UTC
README
与 © Smarkio 反馈 API 通信的加速器
使用 Composer 进行安装和用法
为了获取项目的最新稳定版本,请将以下内容添加到您的 composer.json 文件中
{
"require": {
"smarkio/smarkio-revisor-api-client": "*"
}
}
然后,为了在您的 PHP 文件中使用此加速器,请添加以下内容
require '[COMPOSER_VENDOR_PATH]/autoload.php';
内容
- src/Smarkio/Revisor - 与 Smarkio 反馈 API 交互的代码。
- examples/ - 一些使用此加速器的示例。
开始之前
您需要获取一个 API 令牌以使用 API。此令牌使 API 能够识别尝试发送请求的 Revisor。
用法
发送线索反馈
$api_token = 'YOUR API TOKEN HERE';
$lead_id = '123456789';
$status = 'converted';
// create Feedback based on the leadId in LeadOffice
$feedback = Feedback::createWithLeadId($api_token, $lead_id, $status);
// set Lead's optional parameters
$feedback->setInstantAt(date('Y-m-d H:i:s'));
$feedback->setDescription('Additional information about what happened');
// add Lead's optional extra fields
$feedback->addExtraFields(array('field_1'=>'value_1','field_2'=>'value_2'));
// send the Feedback
$response = $feedback->send();
不使用线索 ID 发送线索反馈
$api_token = 'YOUR API TOKEN HERE';
$external_id = '123456789';
$supplier_id = '1';
$status = 'converted';
// create Feedback with mandatory parameters
$feedback = Feedback::createWithSupplierExternalId($api_token, $supplier_id, $external_id, $status);
// send the Feedback
$response = $feedback->send();