Auto-commit local changes before build (2026-01-16 10:01:42)

This commit is contained in:
Ivo Oskamp 2026-01-16 10:01:42 +01:00
parent abb6780744
commit 748769afc0
3 changed files with 22 additions and 1 deletions

View File

@ -1 +1 @@
v20260115-19-autotask-ticket-create-debug-logging
v20260116-01-autotask-ticket-id-normalization

View File

@ -451,7 +451,19 @@ class AutotaskClient:
if not isinstance(ticket_id, int) or ticket_id <= 0:
raise AutotaskError("Invalid Autotask ticket id.")
data = self._request("GET", f"Tickets/{ticket_id}")
# Autotask commonly wraps single-entity GET results in an "item" object.
# Normalize to the entity dict so callers can access fields like "id" and
# "ticketNumber" without having to unwrap.
if isinstance(data, dict) and data:
if isinstance(data.get("item"), dict) and data.get("item"):
return data["item"]
# Some endpoints/tenants may return a list even for a single ID.
if isinstance(data.get("items"), list) and data.get("items"):
first = data.get("items")[0]
if isinstance(first, dict) and first:
return first
return data
raise AutotaskError("Autotask did not return a ticket object.")

View File

@ -129,6 +129,15 @@ Changes:
- Logged POST /Tickets response characteristics (status, headers, body preview) to diagnose tenants returning incomplete create responses.
- Logged fallback Tickets/query lookup payload and result shape to pinpoint why deterministic lookup fails.
## v20260116-01-autotask-ticket-id-normalization
### Changes:
- Normalized Autotask GET /Tickets/{id} API responses by unwrapping the returned "item" object.
- Ensured the ticket data is returned as a flat object so existing logic can reliably read the ticket id.
- Enabled correct retrieval of the Autotask ticketNumber via a follow-up GET after ticket creation.
- Prevented false error messages where ticket creation succeeded but no ticket id was detected.
***
## v0.1.21