Recent searches
No recent searches
Ticket Import API and attachments
Posted Jan 20, 2023
Hey everyone! I'm migrating some tickets to Zendesk, and using the imports/tickets endpoint.
I have uploaded some files that go along with the tickets, but when I try to create comments on my tickets, it claims that the uploads parameter is invalid for comments. Here's a sample call:
{
"ticket": {
"external_id": "x",
"assignee_id": "x",
"created_at": "2022-11-22T18:49:21Z",
"subject": "Zendesk Merge Test Ticket: Webform 3 with attachment",
"description": "",
"priority": "",
"status": "open",
"group_id": "x",
"ticket_form_id": "x",
"brand_id": "x",
"requester_id": "x",
"tags": [
"no_verification_needed",
"other/unknown",
"other_call_back_request",
"pre-application_help",
"sms_verified_-_no_further_client_verification_needed"
],
"custom_fields": {
"request": {
"custom_fields": {
"id": x,
"value": "x"
}
}
},
"comments": [
{
"author_id": "x",
"created_at": "2022-11-22T18:49:21Z",
"body": "Original Comment."
},
{
"author_id": "x",
"created_at": "2023-01-04T15:13:54Z",
"body": "comment with 1 attachment",
"uploads": [
"zmxrhTsTvLJPmn7dVShufkoTA"
]
},
{
"author_id": "x",
"created_at": "2023-01-08T06:38:05Z",
"body": "Testing multiple files.",
"uploads": [
"6kbSPIUHaDofksZBvznJRWlK1",
"qfhDkaNCVAwPN7Nnxc1an8vFw"
]
}
]
}
}
And here is the response:
{
"error": "RecordInvalid",
"description": "Record validation errors",
"details": {
"uploads": [
{
"description": "Uploads is invalid",
"error": "InvalidValue"
}
]
}
}
Can I assume then, that I cannot attach uploads to comments as part of the import api?
If so, are there restrictions on adding comments (with uploads) to closed tickets?
If I update a ticket multiple times with {"ticket" : {"comment" : {"body":"x"},"uploads":["x":"y"], "author_id" : "x", "created_at" : date}} will it keep creating new comments?
Thanks!!
0
7
7 comments
Marcus Dawideit
Hi Ken,
In the meantime, have you found a solution ? I´m stucking at the same.
Best regards,
Marcus
0
Albin Nilsson af Sillén
Marcus Dawideit
Ken McCartney
Did you guys manage to solve this?
Am stuck on the same issue right now. My task is to import tickets from one Zendesk url to another Zendesk url.
Had no problem with using bulk import to create tickets with comments. However the attachment did not work.
Did ask the same query here
https://support.zendesk.com/hc/en-us/articles/4408887057946?page=1#comment_6162241414810
0
Christopher Kennedy
When you include attachments in the ticket comment, you first have to upload the file. We break down this two-part process in Adding ticket attachments with the API. So in your case, you'd need to download the file from the exported ticket and then upload it to the new instance to include in the imported ticket.
0
Albin Nilsson af Sillén
Hi Christopher Kennedy
Thx for the reply.
So in this case I will need 3 steps:
1. Download the file from the source Zendesk environmnet.
2. Upload the file and get the token towards the target Zendesk environmnet.
3. Attach the file to the ticket, again towards the target Zendesk environment.
Will this work when I am using the endpoint; /imports/tickets/create_many.
Do want to use this endpoint as I get the time metrics.
, Albin
0
Christopher Kennedy
Yes, you would use the same process for bulk importing tickets with comment attachments.
0
Jason Wong
I've tried this and have been getting mixed results. As with Albin's code I've been doing something similar. I download the file from another source, upload into Zendesk. retrieve the token from the response from Zendesk and add that into a JSON for create_many endpoint. It looks all good but when I view my bulk imported tickets the attachments are not to be found broken images. And when I view the ticket details via the API the attachment block is empty.
0
Erica Girges
Sorry to hear you've been having a difficult time getting your attachments to work via API.
Out of curiosity, do you either of you happen to have private attachments enabled?
0