Attachment in a comment trough API
i am having some trouble uploading and add an attachment to a ticket in Zendesk:
my problem is that: the process work without problem but when i try to open the file in zendesk it return me an error loading
My question is: can i upload a file by an http url? cause in the official documentation it add only local files
The process is the following: I receive an input like this [ { "size": 49890, "attachment content": "https://test.atlassian.net/rest/api/2/attachment/content/10126", "filename": "Screenshot 2022-11-29 at 13.49.01.png", "author": "CPS", "mimeType": "image/png" } ]
and i use this HTTP request for make the call: Endpoint: /api/v2/uploads.json?
Header:
Content-Type mimeType
--data-binary attachment content
and after i make another HTTP request: endpoint: /api/v2/tickets/idticket
body {"ticket": {"comment": {"body": "Attachment:","uploads": ["{{$json["token"]}}"]}}}
-
Hi Gabriele,
You'll want to make sure the Content-Type is set to application/binary for external source file uploads. Also, could you try opening the attachment in Zendesk into a new tab?
Please let me know if you're able to do so, this will better help me to troubleshoot the issue you're having.
Best,
Erica
-
Hello Erica,
Thanks for helping me!
I've tried to set the Content-Type to application/binary, but doesn't work.
And also open it in a new tab, but doesn't work same. -
Hello Erica Girges, do you have any other suggestions?
-
Hi Gabriele,
Apologies for the delay, I was out of the office for a bit. That's definitely very strange then. Let me go ahead and pull you into a ticket so we can get a better look.
Best,
Erica
-
Hello Erica Girges,
Sorry I didn't mean to be pushy, but I need to fix it asap.
I will give you more details about the HTTP request:POST
https://sendinblue.zendesk.com/api/v2/uploads.json
query
filename
Screenshot 2022-12-06 at 15.42.30.pngHeaders
Content-Type
application/binaryBody
--data-binary
"https://url...."I hope it's all clear and can help you.
Thanks!
-
Hi Gabriele,
I went ahead and created a ticket for you but can share with you here as well the question that I had.
I noticed the external url for the attachment is to Jira. Do you know if that url is publicly accessible or does it require authentication to access it?
If it does require authentication, that could be why you're unable to view it after attaching it. Any external sources for attachments would need to be publicly accessible for it to be viewable.
Best,
Erica
-
Hello!!
Yes the url is from Jira issue, and I can open the link/attachment if I open it in a new browser tab, so it doesn't required the authentication.
Thanks -
I bet this is the same issue I has faced. ZAF client will not work with
Content-Type
application/binaryYou will need to use for example javascript fetch to call the Zendesk api:
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
But there you will need to provide a authorization header, and you can't use secure settings to my knowledge. So it is a bad solution to a oversight on Zendesks end. -
Hello, Thanks Tuomas Savonius
Can you give me more details, please?I am doing this request in n8n.
-
Can we avoid this problem converting the file in binary?
-
Fixed uploading the file in Binary
Please sign in to leave a comment.
11 Comments