Recent searches
No recent searches
API Upload File
Answered
Posted Jul 16, 2020
Hello all,
I've been trying to attach a file to a ticket via uploads API and the problem that I am encountering is that the file successfully attaches but then when I try to open the file it download to my PC but when I try to open it says file type not supported.
- I am making the request from ServiceNow through post request to https://example.zendesk.com/api/v2/uploads.json
- response status code 201
- Then I take the token in the response to create a new ticket in ZD.
- response status code 201
- file type is JPG
- file size is 1.9 MB
See images below for reference.
1
18
18 comments
enzo fass
Also when I post to the uploads API. I am only providing the file name, is this sufficient?
I have the feeling that it is uploading only the file name and not any contents.
0
Sebastiaan Wijchers
Hello Enzo,
How big is the file you're downloading in Zendesk? Is it 1.9MB like the original, or way smaller?
You should POST the file, there is a curl example in the documentation:
https://developer.zendesk.com/rest_api/docs/support/attachments#upload-files
What's the response body of the call to '/api/v2/uploads.json'?
With kind regards,
Sebastiaan
Sparkly ⭐
0
Nida Patanarat
Hello Enzo,
Could you please share me the solutions on how to fix this?
Thank you very much
Nida
0
Bryan Flynn
Hi @.... Looks like this question was also cross-posted in the developer community. I posted an answer there — please see https://develop.zendesk.com/hc/en-us/community/posts/360050023554/comments/360012872554. If you have follow-up questions, I can answer them there. Thanks!
-1
SAPTARSHI SINHA
Hi All,
When I am trying to upload a file using endpoint (POST /api/v2/uploads.json),
I just noticed that the file is getting uploaded, but the contents of the file(csv) is getting replaced by the Body of the API call. I am simple giving {} in the body, since without a body the API is giving error.
Can someone help me with a body for the endpoint? Or maybe how can I upload it with the contents.
Regards.
Saptarshi
0
Bryan Flynn
Hi @...,
Please give the API call that you are making at any returned HTTP status codes (removing any confidential information of course).
Are you using the example cURL code in the reference documentation for POST /api/v2/uploads.json?
Also check out another community post where the tool Postman was used for a file upload: Unable to upload image file via /api/v2/uploads.json through postman
Keep in mind that uploading and attaching to a ticket is a two step process described here: Attaching files to tickets via API.
0
Paul Cunningham
Hi this link https://develop.zendesk.com/hc/en-us/community/posts/360050023554/comments/360012872554 is no longer valid and i'm facing the same issue.
I'm using the following requests API which allows end-users to submit requests to out support agents.
When uploading the image the following request is made
This response is successful and returns a token which is then passed into the body before submitting the request
However, I'm experiencing the same issue as Enzo. When the ticket is received in the helpdesk it looks like the below.
Any suggestions/help would be appreciated.
0
Eric Nelson
Hey Paul Cunningham,
Looks like that post was archived when we moved over to our new community earlier this year. In regards to your issue, what is the Content-Type that you're setting on the post to the upload endpoint?
Thanks,
Eric
0
Dinesh Korgaokar
Hello,
Facing same issue with request function in APP framework.
0
Greg Katechis
Hi Dinesh! I responded to your comment here, but feel free to respond either in this post or the other one!
0
Chris Green
I am facing this same issue and have not gotten any good support from Zendesk on the issue.....this is quite frustrating. I can make a call to 'List Comments' and see my attachment and can confirm that everything looks good, but when I try to view the attachment in my ticket I'm getting the same as above:
0
Dinesh Korgaokar
hello Chris Green,
faced similar issue. the solution worked for me is adding image blob to the <img src="image blob">. this seems auto uploads the attachments for me.
0
Chris Green
Dinesh Korgaokar - can you provide an example of how this looks in your API call?
1
Dinesh Korgaokar
Hello Chris,
i didn't upload the file separately using api. added the blob of image in the html body and uploaded. it auto uploaded the attachments.
0
Chris Green
Well do you have an example of that?
0
Chris Green
Any updates from anyone who was having this issue?
0
Benessa Dumol
Hello, sorry for hijacking this thread, but I am currently stuck and I desperately need some help.
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:
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 you help to confirm if it is possible to attach multiple files/images to 1 ticket comment? If yes, can you point me in the right direction?
Thank you,
0
Dinesh Korgaokar
Benessa Dumol
are you using below JSON to send data,
-d '{"ticket": {"comment": {"body": "Press play", "uploads": ["4bLLKSOU63CPqaIeOMXYyXzUh"]}}}'
if yes then u need to send array of upload tokens you received after uploading.
"uploads": ["token1", "token2", "token3"]
Hope this helps,
Dinesh
0