Merge tickets with API

  • Used Zammad version: 3.2.x
  • Used Zammad installation source: (source, package, …) package
  • Operating system: CentOS 7
  • Browser + version: Chrome on Linux

Hi,
I’m migrating from RT, managed to transfer all the history but cannot seem to merge the tickets that were merged in RT.
I followed the transactions in RT and replicated them with the Zammad API. I couldn’t process the merges as if I simply try to change the state_id to 5 (merged) and the number to match the ticket I want to merge it into I get an “Object already exists!”.

When I merge a ticket with the web interface I see that there’s a new record in the links table and several (7 I think) in the histories table.
I can also see the state_id on the child ticket changing to merged.

Is there any way to process the merge of 2 tickets with the API?

Failing that, would changing the state_id + creating a record in the links table suffice or do I need to write the histories as well. Is there anything else I’d need to do or do you have a way of achieving this?
Thanks and regards,
Federico

1 Like

This sounds like the ticket you’re trying to merge is already linked to the ticket you’re trying to merge into. Ensure the tickets are not linked with each other and if they are, remove that link.

Zammad adds a link between those tickets during merging and fails if it can’t.

yes that’s perfectly possible. The webapp doesn’t do anything else.

Hi,
I checked and the tickets are not merged yet.
Here’s what I send and what I receive from the API, I guess I’m using the wrong details.

[14-Dec-2010 11:04:21 UTC] {“id”:“2041”,“number”:“4300000010”,“state_id”:5}
[14-Dec-2010 11:04:25 UTC] RESULT: {“error”:“Object already exists!”}

2041 is the id of the child
4300000010 is the number of the parent (not the id)

Here’re the tickets
MariaDB [zammad]> select id,state_id,number from tickets where id=2041 or number=‘4300000010’;
±-----±---------±-----------+
| id | state_id | number |
±-----±---------±-----------+
| 2028 | 4 | 4300000010 |
| 2041 | 2 | 4300000023 |
±-----±---------±-----------+

Am I using the wrong parameters, should I use something different instead of the number.
Thanks for your help,
Federico

Hi,
I managed to do it, going through the code I found that I have to use /api/v1/ticket_merge/2041/4300000010
instead of
/api/v1/tickets/2041/
This function (ticket_merge) doesn’t appear in the documentation on the website. Is there anywhere where I can find the full api documentation?
Thanks for your patience.
Federico

3 Likes

Glad you could solve your issue.

I’m afraid the documentation von docs.zammad.org is the latest version of our api documentation.
We’re working hard on enhancing the documentation, but you can imagine that it’s a time consuming job. :smiley:

What I usually do when I’m unsure what’s happening, I’ll open a develoepr console with network tab and then trigger what I wanna do via web ui. It does use the API, so you can lurk around there.

Might come in handy at some point.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.