PHP code example of datana-gmbh / zammad-api

1. Go to this page and download the library: Download datana-gmbh/zammad-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

datana-gmbh / zammad-api example snippets


use Datana\Zammad\Api\ZammadClient;

$baseUri = 'https://...';
$token = '...';

$client = new ZammadClient($baseUri, $token);

// you can now request any endpoint which needs authentication
$client->request('GET', '/api/something', $options);

use Datana\Zammad\Api\Domain\Value\Ticket;
use Datana\Zammad\Api\TicketsApi;
use Datana\Zammad\Api\ZammadClient;

$client = new ZammadClient(/* ... */);

$ticketsApi = new TicketsApi($client);

$ticket = new Ticket(/* ... */);
$responseAsBool = $ticketsApi->create($ticket);

use Datana\Zammad\Api\TicketsApi;
use Datana\Zammad\Api\ZammadClient;

$client = new ZammadClient(/* ... */);

$ticketsApi = new TicketsApi($client);

$responseAsBool = $ticketsApi->update(1, ['email' => '[email protected]']);

use Datana\Zammad\Api\TicketsApi;
use Datana\Zammad\Api\ZammadClient;
$client = new ZammadClient(/* ... */);

$responseAsArray = $ticketsApi->search('foo');