ためしてちょいちょい追加します。
0. 準備
composer.json
{
"require": {
"zendesk/zendesk_api_client_php": "dev-master"
}
}
install
$ composer install
1. 問い合わせ登録
<?php
require 'vendor/autoload.php';
use Zendesk\API\HttpClient as ZendeskAPI;
$subdomain = "xxx";
$username = "xxx";
$token = "xxx";
$client = new ZendeskAPI($subdomain, $username);
$client->setAuth('basic', ['username' => $username, 'token' => $token]);
// カスタムフィールド(任意)
// フィールドのIDはカスタムフィールドの詳細ページに表示されるIDを入れる
$custom_fields = array();
$custom_fields[] = array("id" => "27903658", "value" => "1234567"); // 注文番号
$custom_fields[] = array("id" => "27895577", "value" => "5678901"); // ○○ 番号
// 問い合わせした人情報
$requester = array(
"name" => "なまえ",
"email" => "foo@example.com",
);
$ticket = array(
'subject' => 'APIからのチケット登録テスト2',
'comment' => array(
'body' => "本文あああ\n2行目\n3行目"
),
'priority' => 'normal',
'custom_fields' => $custom_fields,
'requester' => $requester,
);
$newTicket = $client->tickets()->create($ticket);
print_r($newTicket);