Attachment in a comment trough API



Posted Nov 29, 2022

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"]}}"]}}}


0

11

11 comments

Fixed uploading the file in Binary

0


Can we avoid this problem converting the file in binary?

0


Hello, Thanks Tuomas Savonius

Can you give me more details, please?

I am doing this request in n8n.

0


I bet this is the same issue I has faced. ZAF client will not work with

Content-Type 
application/binary

You 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.

0


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

0


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

0


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.png

Headers
Content-Type 
application/binary

Body
--data-binary
"https://url...."

 

I hope it's all clear and can help you.

Thanks!

0


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

0


Hello Erica Girges, do you have any other suggestions?

0


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.

0


Sign in to leave a comment.

Didn't find what you're looking for?

New post