-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_ticket.php
More file actions
26 lines (23 loc) · 884 Bytes
/
create_ticket.php
File metadata and controls
26 lines (23 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once 'vendor/autoload.php';
use ZammadAPIClient\Client;
use ZammadAPIClient\ResourceType;
$client = new Client([
'url' => 'http://localhost:3000', // URL to your Zammad installation
'username' => 'your_login@email_address.com', // Username to use for authentication
'password' => 'your_password', // Password to use for authentication
// 'debug' => true, // Enables debug output
]);
$ticket_text = 'API test ticket';
$ticket_data = [
'title' => $ticket_text,
'customer' => 'customer_email@address.com',
'group' => 'Users',
'article' => [
'subject' => $ticket_text,
'body' => $ticket_text,
],
];
$ticket = $client->resource(ResourceType::TICKET);
$ticket->setValues($ticket_data);
$ticket->save();