Upload Multiple Files (Uploads API) and Add as Attachment to Ticket Comment (Tickets API)
Answered
Posted Aug 12, 2022
Hello,
I am currently developing an app that has 2 fields, a file upload field that allows multiple files and a text area.
Here is the current status of the app:
- I was able to create a private comment using the value inputted on the text area
- I was able to get the token when I uploaded the files using the Upload API
The next goal is for all the files to be attached to the ticket. I am using this as my reference and on the examples, only 1 file is attached to the ticket comment.
Can someone confirm if it is possible to attach multiple files/images to 1 ticket comment? If yes, can someone point me in the right direction?
Thank you,
Benessa
0
5
5 comments
Benessa Dumol
Hello Serge BERTAINA DUBOIS,
Happy to inform you that I was able to make my code work.
Thank you for your help.
~ Benessa
0
Benessa Dumol
Hi Serge BERTAINA DUBOIS,
May I ask what is the correct data format that I need to pass on the data parameter to /api/v2/uploads.json to get the upload token?
It seems that I am not passing the correct data on the /api/v2/uploads.json?filename=attachment.jpg API endpoint. Currently, I am passing the filename and when it was uploaded and attached to the ticket I am getting the error Error loading image when I tried opening the attached file.
I also tried passing Binary and Base64 data but I am getting the error
Appreciate your response.
Thank you,
0
Serge BERTAINA DUBOIS
Hi Bennessa,
However, I manage to do this.
Below is a piece of my python code to upload multiple files in a single comment.
You see that I first load an Array :
then that in my json ticket I specify my array in uploads.
In hope this will help you.
Friendships,
Serge.
0
Benessa Dumol
Hi Serge BERTAINA DUBOIS,
Actually, I am passing multiple files to Uploads API but I think since the Content-type is application/binary it only allows 1 file to be uploaded. Thus, it only generates 1 token that I can use when I create a new comment using the Tickets API.
Do you have any idea or workaround on how can I attach more than 1 file to the new comment using the Uploads API?
Appreciate your response.
Thank you,
Benessa
0
Serge BERTAINA DUBOIS
Hello,
As you can see on the documentation page you specify, in the json, attachments is an array.
Du can therefore specify several elements in this array:
I admit not having had this need and therefore not tested, but I think it's a good way.
Serge.
0
Sign in to leave a comment.