Zum Inhalt springen

OTOBO API Tickets

Die Ticket-Routen nutzen dieselben Felder wie die Agentenoberfläche: Titel, Queue, Status, Priorität, Typ, Kundenbenutzer und den ersten Artikel.

Aktion Aufruf
Suchen und listen GET /tickets?queue=Service%20Desk&state=new&limit=20&offset=0
Ein Ticket GET /tickets/42
Anlegen POST /tickets
Teiländerung PATCH /tickets/42

Suchparameter: queue, state, priority, type, title, ticketNumber, customerUser, limit, offset. GET /tickets ist die Liste. GET /tickets/{id} ist ein Ticket. Es gibt keinen eigenen Pfad für find oder findAll.

{
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
}

Die Antwort enthält id und ticketNumber.

PATCH sendet nur die Felder, die sich ändern.

{
"state": "open",
"priority": "4 high"
}

Eine Queue, die der Benutzer des Tokens nicht schreiben darf, liefert 403.

import requests
payload = {
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
}
response = requests.post(
"https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets",
headers={"Authorization": "Bearer YOUR_TOKEN"},,
json=payload
timeout=30,
)
response.raise_for_status()
print(response.json())
const payload = {
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
};
const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
String payload = """
{
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
}
""";
HttpRequest.BodyPublisher body = HttpRequest.BodyPublishers.ofString(payload);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets"))
.header("Authorization", "Bearer YOUR_TOKEN")
.header("Accept", "application/json")
.method("POST", body)
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$payload = <<<'JSON'
{
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
}
JSON;
$ch = curl_init("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_TOKEN",
"Accept: application/json",
"Content-Type: application/json",
],
CURLOPT_RETURNTRANSFER => true,
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body;

Ausführliche Beispiele, eine Sprache pro Seite:

Zulässige Werte für Queue, Status und Typ kommen von den Katalog-Routen.

Häufig gestellte Fragen

Welche HTTP-Methode ändert ein Ticket?

PATCH /tickets/{id} ändert nur die Felder, die Sie senden. Einen eigenen Vollersatz-Aufruf gibt es nicht.

Quellen

Wie suche ich Tickets?

GET /tickets mit Parametern wie queue, state, title, ticketNumber, limit und offset.

Suchparameter: queue, state, priority, type, title, ticketNumber, customerUser, limit, offset. GET /tickets ist die Liste. GET /tickets/{id} ist ein Ticket. Es gibt keinen eigenen Pfad für find oder findAll.

Quellen

Workflows und Schnittstellen

Webservices, Prozesse und Anbindungen, die zu Ihrer Landschaft passen.