API Upload File

Answered

16 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!

    0
  • 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.

    /api/v2/requests.json

    When uploading the image the following request is made 

    api/v2/uploads.json?filename=upload.fileType

    This response is successful and returns a token which is then passed into the body before submitting the request 

    {
    "request":{
    "requester":{
    "name":"Test",
    "email":"test@gmail.com"
    },
    "subject":"help",
    "comment":{
    "body":"help",
    "uploads":[
    "mytoken"
    ]
    }
    }
    }

    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
    Zendesk Developer Advocacy

    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
    Zendesk Developer Advocacy

    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?

    0
  • 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

Please sign in to leave a comment.

Powered by Zendesk