API Create Ticket with reminder

Infos:

  • Used Zammad version: 5.4.0-1678896189.86ee6527.bullseye
  • Used Zammad installation type: package
  • Operating system: Debian 11

Hello,

I want to create a ticket using the API, that has state set to “pending reminder” and the pending date set to a specific date. I manage to create a ticket using the API, however, neither the state nor the Pending Reminder are being set. Instead default values appear to be set, so I’m guessing I’m doing something wrong. Maybe someone could look over my code snippet and tell me how to fix it :slight_smile:

<?php
$end_date = str_replace("/", "-", $end_date) . "T23:59:59Z"; //e.g 2024-03-07T23:59:59Z
$url = "https://zammad.example.org/api/v1/tickets";
$data = array(
    "title" => "Test Ticket",
    "group" => "MyGroup",
    "customer" => $mail,
    "article" => array(
        "body" => "Content of the ticket",
        "type" => "note",
        "internal" => false,
        "priority" => "1 low", // Doesn't work, Priority is always set to "normal" 
        "name" => "pending reminder", // Doesn't work, state is always set to "New"
        "pending_time" => $end_date // Doesn't work, no reminder is created
    )
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array(
    "Accept: application/json",
    "Content-Type: application/json",
    "Authorization: Token token=TOKEN",
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
curl_close($ch);

Thanks for all help in advance

“pending_time” has to be set to the ticket, not to the article. And you have to set the corresponding “state_id”.

Thanks, that was it :+1:

1 Like

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.