【发布时间】:2021-02-23 11:15:44
【问题描述】:
对于那些不想阅读整个问题的人:
我正在寻找 API-Request (Zammad) 中的索引,以便在创建票证时设置标签。
详情:
我正在使用 PHP 向安装了 Zammad 的服务器发出 API 请求。下面是我通过 curl 发送的数据:
json_encode([
"title" => $title,
"group_id" => 2,
"priority_id" => 2,
"category" => 'Some Category',
"state_id" => 1,
"type" => "Some Type",
"customer" => $userID,
"article" => [
"body" => $htmlBody,
"type" => "note",
"content_type" => "text/html",
],
"tag_list" => [ // <-- The question is about this segment
"The tag i want to add",
],
]);
将数据转换为 JSON 后,我通过 POST 将其发送到 http://
到目前为止我所做的尝试:
我试着猜测我失败的标签的索引。
第一个完整示例如上所示。
其次:
...
"tag_id" => 9, // I've check its the actual ID of the tag i want to add
最后:
...
"tag" => "The tag i want to add",
不用说我没有成功。有时我得到一个错误 ID(我假设它是因为索引不存在 [谁会想到?:)]),有时我什么也没得到,Zammad 只是创建没有标签的票。我有时说什么是什么意思?我参考了上面指定的尝试。
我也尝试过:
在网上搜索一些答案。接近我想要的东西是this。但我宁愿创建带有标签的票证,而不是仅仅为了添加标签而发出另一个请求。
【问题讨论】: