【发布时间】:2020-04-06 14:23:22
【问题描述】:
我正在尝试通过 PHP 和 OTRS (https://doc.otrs.com/doc/manual/admin/6.0/en/html/genericinterface.html#id-1.6.12.10.7.2) 的 REST 通用接口创建票证。
我可以创建票证,也可以创建文章。但是,OTRS 历史记录看起来像是用户正在向队列发送票证,而不是传出电子邮件。而且也没有邮件发送给客户:-(。 但我喜欢有一个传出的电子邮件工单和一个待处理的工单状态。
这是我的 PHP 代码
<?php
header("Content-type: application/json; charset=utf-8");
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'http://test-otrs.company.local/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/']);
$arrTicket = array(
"Title" => 'some ticket title',
"Queue" => 'testqueue',
"Lock" => 'unlock',
"Type" => 'Unclassified',
"State" => 'new',
"Priority" => '3 normal',
"Owner" => 'username',
"CustomerUser" => 'user@test.com'
);
$arrArticle = array(
"CommunicationChannel" => 'Email',
"SenderType" => 'agent',
"To" => 'user@test.com',
"Subject" => 'some subject',
"Body" => 'some body',
"ContentType" => 'text/plain; charset=utf8'
);
$response = $client->post('Ticket', ['json' => array("UserLogin" => "username", "Password" => "testtesttest", "Ticket" => $arrTicket, "Article" => $arrArticle)]);
if ($response->getBody())
{
echo $response->getBody();
}
【问题讨论】:
-
你尝试过什么调试问题?
-
我做了什么:试图找到有效的 PHP 示例(找不到一些)。切换到/从键。尝试不同的 SenderType 和 CommunicationChannels