Importing Tickets and Articles using the API

I’m trying to migrate my tickets / articles from another ticket system using the API.
This works fine so far. However I encounter a few difficulties:

  • When creating a ticket, I can add "state" => "closed", for old tickets. However, when I add additional articles to the ticket, the customer gets notified on each and every update. How can I silently add articles to the tickets?
  • When I add attachments to an article via the API, a questionmark symbol surrounded by a square border is displayed as an icon in front of the files, even though I have assigned a mime-type. When a ticket is added via an email with attachments, the files do have an Acrobat Reader symbol for PDF-files and a preview / thumbnail in case of a PNG image file. Is this an issue with the API or am I doing something wrong?
  • I would like to set the original timestamps for the ticket creation, but when I add a created_at field it seems to be ignored. The ticket is still displayed with the current creation time.

Any hints or ideas on this would be greatly appreciated!

With kind regards

Andreas

Hi Andreas,

This might help you:

Rails Console: Console — Zammad System Documentation documentation

Setting.set('import_mode', true)
Setting.set('system_init_done', false) 

You will have to set a date for the ticket as well as for the article. I had the same issue where I created tickets with a historical date but because I didn’t set that date for the article, the article was created with the current time and the ticket was listet as a recent ticket instead as an old ticket.

Regards,
Gijs

1 Like

Thank you very much @ecomsilio, that was really helpful!

Looks like the only issue I still have is that the imported files don’t show an icon / thumbnail.
Have you also imported files / attachments?

1 Like

No, I haven’t tried attachments.
I can’t help you with that unfortunately.

Thank you again @ecomsilio, you have solved two issues out of my three-part-question.
After fiddling with the issue of not correctly displayed thumbnails in front of attachments, when they were added via API, I decided to accept your answer as a solution and create an issue at GitHub: https://github.com/zammad/zammad/issues/3309

This issue also contains a full example to make it easier to understand / reproduce the issue.

With kind regards
Andreas

2 Likes

Good afternoon, could you please send your script for importing applications. I would be very grateful to you!

1 Like