Auto-commit local changes before build (2026-01-19 13:15:08)
This commit is contained in:
parent
07e6630a89
commit
d5e3734b35
@ -1 +1 @@
|
|||||||
v20260119-04-autotask-ticket-registration
|
v20260119-05-autotask-create-itemid
|
||||||
|
|||||||
@ -414,7 +414,10 @@ class AutotaskClient:
|
|||||||
raise AutotaskError("Ticket payload is empty.")
|
raise AutotaskError("Ticket payload is empty.")
|
||||||
|
|
||||||
data = self._request("POST", "Tickets", json_body=payload)
|
data = self._request("POST", "Tickets", json_body=payload)
|
||||||
# Autotask commonly returns the created object or an items list.
|
# Autotask commonly returns only an itemId on create.
|
||||||
|
# We normalize that into a dict with an "id" key so callers can
|
||||||
|
# perform a follow-up GET /Tickets/{id} to retrieve the full object
|
||||||
|
# and the human-facing ticketNumber.
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
if "item" in data and isinstance(data.get("item"), dict):
|
if "item" in data and isinstance(data.get("item"), dict):
|
||||||
return data["item"]
|
return data["item"]
|
||||||
@ -422,6 +425,17 @@ class AutotaskClient:
|
|||||||
first = data.get("items")[0]
|
first = data.get("items")[0]
|
||||||
if isinstance(first, dict):
|
if isinstance(first, dict):
|
||||||
return first
|
return first
|
||||||
|
# Autotask create responses often look like: {"itemId": 12345}
|
||||||
|
item_id = data.get("itemId")
|
||||||
|
if item_id is None:
|
||||||
|
item_id = data.get("itemID")
|
||||||
|
if item_id is not None:
|
||||||
|
try:
|
||||||
|
tid = int(item_id)
|
||||||
|
except Exception:
|
||||||
|
tid = 0
|
||||||
|
if tid > 0:
|
||||||
|
return {"id": tid}
|
||||||
if "id" in data:
|
if "id" in data:
|
||||||
return data
|
return data
|
||||||
# Fallback: return normalized first item if possible
|
# Fallback: return normalized first item if possible
|
||||||
|
|||||||
@ -233,6 +233,14 @@ Changes:
|
|||||||
- Added repair/propagation logic so runs that already have an Autotask ticket ID but lack internal linking are corrected automatically.
|
- Added repair/propagation logic so runs that already have an Autotask ticket ID but lack internal linking are corrected automatically.
|
||||||
- Guaranteed that future runs for the same job inherit the existing Autotask and internal ticket associations.
|
- Guaranteed that future runs for the same job inherit the existing Autotask and internal ticket associations.
|
||||||
|
|
||||||
|
## v20260119-05-autotask-create-itemid
|
||||||
|
|
||||||
|
### Changes:
|
||||||
|
- Updated Autotask ticket creation handling to treat a POST response containing only {"itemId": <id>} as a successful ticket creation.
|
||||||
|
- Normalized the create response so the returned itemId is mapped internally to a ticket id, ensuring the existing follow-up GET /Tickets/{id} flow is always executed.
|
||||||
|
- Fixed erroneous failure condition where ticket creation was rejected because Autotask did not return a full ticket object.
|
||||||
|
- Restored compatibility with Autotask’s documented behavior for ticket creation responses.
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
## v0.1.21
|
## v0.1.21
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user