Hi. My integration must change custom fields to set values and eventually add attachments to tickets. To test I have built the basic setup to make this work.
I am able to authenticate my integration, send my payload and receive the full ticket data back, but the custom fields do not change to their required values.
Pasting the code for inspection. To be clear, I have validated all variables, and we're getting a 200 response so it's all working. Just adding a comment as well, but I have attempted this simple change with just the custom_fields object, an all other combinations.
complete_url = f"{url}{endpoint}/{ticketID}.json"
payload = {
'ticket': {
'subject': f"**Ignore** Test #1 {datetime.now().isoformat()}",
'comment': {
'body': f"Ticket updated by API {datetime.now().isoformat()}",
"public": True
},
'custom_fields': [
{'id': 24957236561433, "value": "job_status_approved"},
{'id': 33979528184729, "value": "098098"},
{'id': 24956990570521, "value": "89.09"},
]
}
}
zdret = requests.put(complete_url,
auth=auth,
json = json.dumps(payload),
headers = headers
)match zdret.status_code:
case (200 | 201):
retjson = zdret.json()
returned_ticket = retjson['ticket']['id']
print(f'Successfully amended ticket #{returned_ticket}\nStatus code: {zdret.status_code}')for cs in retjson['ticket']['custom_fields']:
if cs['id'] in [24957236561433, 33979528184729, 24956990570521]:
print(cs)
Results: I'm not able to paste the entire returned ticket data but the custom fields are unchanged:
Successfully amended ticket #11042
Status code: 200
{'id': 33979528184729, 'value': 'quoteRef'} {'id': 24956990570521, 'value': '123.4'} {'id': 24957236561433, 'value': 'job_status_quote_sent'}
Can anyone spot the bug or help me figure the issue out? Are there any other areas in the Zendesk UI I should check that may block these changes?
Thanks in advance.