My goal is to create a ticket in Zammad using the API and then to update it (for.
the reference for such basic tasks is here
I am using Postman to send requests.
I use the bearer token authentication, the token has been generated for a user who is ticket.agent (and he is admin too).
I manage to succesfully create a ticket by doing a post request to
https://myzammadinstance.com/api/v1/tickets
and with this body:
{
"title": "Ticket generated from API - my test",
"group": "Users",
"article": {
"subject": "My Subject",
"body": "My body",
"type": "note",
"internal": false
},
"customer": "my@email.address",
"user": "my@email.address",
"note": "my notes"
}
This succesfully creates a ticket (with a given ID, let's say 1990).
Now i would like to update this ticket, so "replying from API".
I do a post request to
https://myzammadinstance.com/api/v1/tickets
and with this body:
{
"id": 1990,
"title": "updated title",
"group": "Users",
"state": "open",
"customer_id": 12,
"priority": "3 high",
"article": {
"subject": "some subject of update",
"body": "some message of update"
}
}
This executes but does not append a reply to my ticket 1990 but it generates a new ticket (with id 1991 and title "updated title").
I do not want to create a new ticket but just reply to an existing ticket.
May i misunderstood something but i double checked many times the documentation and the request body.
Anyone could give an hand please?
UPDATE: as stated in the comments is seems i should use https://myzammadinstance.com/api/v1/tickets/1990
but this does not work: a new ticket is not created but the response has an error:
{
"error": "No route matches [POST] /api/v1/tickets/1990"
}
SOLUTION
The problem was in PUT
vs POST
, by using PUT
and this endpoint
https://myzammadinstance.com/api/v1/tickets/1990
i managed to reply to the ticket.
To update the ticket you would need to use this endpoint:
PUT /api/v1/tickets/{id}