Jump to content

Manuel

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Manuel

  1. Hello,
     

    A idea below... it works.

    <?php
    require_once "blesta_api.php";
    
    $user = "apiuser";
    $key = "apipw";
    $url = "https://domain.tld/api/";
    
    $clientmail = "test@demo.tld";
    $ticketsummary = "This is a test.";
    $ticketmsg = "Hello, I am unable to login. Please help!!";
    
    $ticket_data = [
        'vars' => [
            'department_id' => 1,
            'staff_id' => 1,  // optional, set staffID
            'service_id' => null,  // optional
            'client_id' => null,  // optional
            'email' => $clientmail,  // optional
            'summary' => $ticketsummary,
            'priority' => 'critical',
            'status' => 'open'
        ]
    ];
    
    $api = new BlestaApi($url, $user, $key);
    
    $ticket = $api->post("support_manager.support_manager_tickets", "add", $ticket_data);
    
    $zzid = $ticket->response();
    
    $reply_data = array(
        'ticket_id'=> $zzid,
        'vars' => array(
            'ticket_id'=> $zzid,
            'staff_id' => null,
            'client_id' => null,
            'contact_id' => null,
            'type' => "reply",
            'details' => $ticketmsg,
            'status' => "open",
            'staff_id' => null,
        ),
        'files' => null,
        'new_ticket' => false
    );
    
    
    $response = $api->post("support_manager.support_manager_tickets", "addReply", $reply_data);
    
    ?>

     

×
×
  • Create New...