Infos:
- Used Zammad version: 3.6.x
- Used Zammad installation source: package
- Operating system: Zammad runs on a Linux distro, i’m accessing the API from Windows 10 WSL
- Browser + version: Firefox 85.0.2 (not relevant)
I’m trying to create a ticket programmatically from Python on our self-hosted Zammad server running 3.6.x
The token i’m using is for my account which is admin on the server.
I’m going by the documentation at https://docs.zammad.org/en/latest/api/ticket.html#create
That documentation is incorrect. When i provide just the indicated fields, my request is refused because the field “customer_id” is missing.
I’ve made progress by being able to create a user automatically, and providing that new user’s id as “customer_id”. The Ticket is created but not the Article, and i get an HTTP 500 return code with an explanation: “error”:“no implicit conversion of Symbol into Integer”. I’ve tried tens of combinations and cannot figure out which field is causing the problem.
Expected behavior:
- Ticket and article should be created by API POST /api/v1/tickets
Actual behavior:
- Ticket is created, new, no owner, priority 2, in the correct group, with the correct customer. But the article is not created. I get an HTTP 500 return code with an explanation: “error”:“no implicit conversion of Symbol into Integer”.
Steps to reproduce the behavior:
#! /usr/bin/python3
import json, requests
token = 'MRk..." # enter my token here. my account is admin and agent
auth = f'Token token={token}'
def create_ticket():
url = 'https://support.example.com/api/v1/tickets'
new_ticket = {
"title": "Request access",
"group": "Access to service",
"customer_id": customer_id, # fetched previously, an int = 1234
"article": {
"from": "user@example.com", # this is the email and login of customer 1234
"subject": "Request access",
"internal": False,
"sender": 'Customer',
"type": "note", # note or web or email or phone
"body": "TEST TICKET"
}
}
print(json.dumps(new_ticket, indent=4))
req = requests.post(url, headers={'Authorization' : auth}, data = new_ticket)
if (req.status_code != 201):
print(f"Error: {req.status_code} {req.reason}")
print(f"{req.text}")
print(req.json())
return(0)
create_ticket()