问题
是否可以使用 Zendesk API 将文件(例如照片)附加到工单?
回答
可以,当文件附加到工单时,如果帐户需要身份验证才能下载附件,则附件仅对有权访问工单的用户可见。在附件与工单关联之前,任何已通过身份验证的用户都可以使用其 content_URL
。附件的密钥将在 60 分钟后过期。
因此,您需要
- 使用上传文件 API 端点,该端点会返回一个密钥。
- 在创建或更新工单时,通过
uploads
数组将密钥包括在工单评论中。如果不完成此步骤,Zendesk 将删除已上传的文件,并在上传密钥过期时显示404 not found
出错消息。
例如
{ "ticket": { "comment": { "body": "See screenshot.", "uploads": ["vz7ll9ud8oofowy"] } } }
27 条评论
cunningj
The change to 60 minutes for token expiration is very unwelcome. Please return to the 3 day token expiration window that was previously in place. It used to be possible to safely prepare and execute the Tickets Bulk Import endpoint to efficiently run thousands of tickets. This change pushes me to need to now consider running each ticket import individually, doing a just-in-time upload of the files needed for the comments in ticket.
0
Vinicius Henrique da Silva
que instrução vazia.
Pq a zendesk tem dificuldade de orientar o básico de como fazer?
0
Albin Nilsson af Sillén
Hi Paolo
Thx for the reply.
Did make the suggested api calls using postman to get data for the attachment.
However, it does look very similair to the data returned from the endpoint: tickets/${ticket.id}/comments. The data returned from this call was added to the tickets object before bulk import it.
This creates a ticket with comments, but the attachment does not follow with.
Am i right to assume that if I use the Incremental Ticket Event Export, I can use this data to add both comments and attachment when doing the bulk import using the endpoint; imports/tickets/create_many
Thx again, Albin
0
Paolo
If you are trying to get the ticket attachments, you may use the Incremental Ticket Event Export. Sample:
GET /api/v2/incremental/ticket_events.json?include=comment_events,attachments,tickets,agreements&start_time={epoch_time}
.1
Albin Nilsson af Sillén
Hi all
How would this work if I am planning to do a Bulk Import with the endpoint tickets/create_many?
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/.
Do use this endpoint as I get the tickets metric, am able to get the comments for the tickets, but the attachments does not come with.
This is my code:
0
Viktor Osetrov
You can achieve it using 2 steps:
1.
POST /api/v2/uploads
Use this Attachment API endpoint for uploading your file.
Curl sample:
Payload example:
2.
PUT /api/v2/tickets/{ticket_id}
Use this Ticket API endpoint for updating your ticket.
Example payload
Please notice
- please replace your data accordingly
- the token is valid for 3 days,
- make sure to include the right content type in the headers. For example: "image/png", "text/plain", "multipart/form-data", "application/json" etc.
Hope it helps
0
Mahendran Ponnusamy
Hi,
I want to upload the attachment for the respective ticket. Is it possible in ticket import API?
Thanks,
0
Christopher Kennedy
The token value itself may be invalid for some reason. To test this, can you successfully create/update the ticket with an empty uploads array?
0
Marcus Dawideit
Hello,
With the example from above and the current attachment token I always get the following error message back:
API Request:
Any recommondations or advices ?
Thanks !
Best regards,
Marcus
0
Sabra
Hey folks! Based on the questions being asked, I wanted to make sure you were aware of our Developer Support team. They have more in-depth knowledge of our platform tools and will be able to get you the best possible answers and solutions. This team works out of our Developer Support community, which will also give you the opportunity to have other developers to share their insight as well! To get in touch, please go to the community and include as much relevant information in your post as you feel comfortable sharing.
0
请先登录再写评论。