Attaching files to tickets via API

Have more questions? Submit a request

21 Comments

  • Clare Lo
    Comment actions Permalink

    Hello Chris,

    Can we attach other file formats to a ticket? For example, users can attach documents and videos to a ticket. 

    0
  • Phil
    Comment actions Permalink

    This resource is rather sparse! Might as well go straight to https://developer.zendesk.com/rest_api/docs/core/attachments#uploading-files :p

    0
  • Rebecca
    Comment actions Permalink

    Hi Clare- 

    You can use the upload attachment API to upload the same type of files as you can via the agent interface. 

    0
  • Vaishali
    Comment actions Permalink

    I am using attachment API to upload any files to create ticket.When I check ticket and download that attachemnt , it is not download.

    Note : filename like abc.png is in my system .

    const url = "https://fyttest.zendesk.com/api/v2/uploads.json?filename="+filename;

    Request json :

    {
    "attachment": {
    "size": size
    }
    };

     

    Ques : Is there anything missing in Request json fields?

    0
  • Dwight Bussman
    Comment actions Permalink

    Hi Vaishali,

    I'm afraid I'm not understanding your question. It looks like you've already reached out to support@zendesk.com with a very similar question. I'll see that someone reaches out to you on that ticket as we may need to get more clarification/examples to see what's going on here.

    Thanks,

    0
  • Ricardo Marquez
    Comment actions Permalink

    Does this work creating ticket as requester? because i am trying to do it and image is not showing on my support zendesk.

    {
      "ticket": {
        "comment":  { "body": "See screenshot.", "uploads":  ["vz7ll9ud8oofowy"] }
      }
    }

    0
  • Dwight Bussman
    Comment actions Permalink

    Hi Ricardo,

    The syntax you sent there looks correct to me! Is it possible that the upload-token has already been consumed? If it's already been used in a given ticket-comment, it's attached to that ticket and subsequent requests using that same token will not attach it to tickets. In that case, it should be possible to reference the attachment URL from the original comment, but this requires permission to access the original location.

    If you'd like us to look into your case more closely, please feel free to reach out to support@zendesk.com or I'd be happy to take this conversation into a ticket for privacy.

    0
  • Chinmay Narwane
    Comment actions Permalink

    Hi Folks,

    I am trying to post an attachment through API to a newly created ticket. I read all the material on the Support but still could not find how this can be done without an ID. 

    Can anyone please help ? My Use Case is as below.

    Get Comment and Attachment from DW 

    Create a ticket in Zendesk with Attachment

    Thanks in Advance,

    Chinmay

    0
  • Dylan Tragjasi
    Comment actions Permalink

    Hi Chinmay,

    It is currently only possible to include attachments to tickets via the API by first uploading the required attachment using the Uploading files API
    Once uploaded, you can use the resulting token ID to include this in any ticket where required.

    In your particular use case, you'd need to follow these steps for this to work:

    1. Get Comment and Attachment from DW 
    2. Upload attachment using the Upload Files API Endpoint
    3. Create a ticket in Zendesk with newly uploaded file

    It is not currently possible to create a ticket and upload a new file as an attachment in a single request.

    Hope this helps clarify!

    - Dylan

    0
  • Chinmay Narwane
    Comment actions Permalink

    Hi Dylan,

    Thank you for the quick response.

    Could you please share the syntax to upload a file followed by getting the token? I am new to this and I could not find anything where we can directly upload a file without ID and then get the token number ? 

    Thanks in advance.

    Chinmay

    0
  • Dylan Tragjasi
    Comment actions Permalink

    Hey Chinmay,

    I'm going to take this into a ticket and email you directly to help troubleshoot any issues you're currently having uploading files to then use as attachments. 

    Look out for an email from me shortly!

    - Dylan

    0
  • Vyacheslav Meshkov
    Comment actions Permalink

    Hi, Dylan,

    I used your ZDKRequestAttachment API and it's OK. But I have some  questions:

    - How to find out that it's a first request message (support conversations just started); maybe message count in support session could be requested

    - Is it possible to attach just URL (or maybe initialize request message text with initial text data)

    - How to use static method HelpCenterActivity::isShowingHelp and is it possible to do the same on iOS?

    Best regards,

    Vyacheslav

    0
  • Bryan - Community Manager
    Comment actions Permalink

    Hello Vyacheslav Meshkov -- this looks like a mobile development question. This article is focused just on the REST attachment APIs. For mobile specific community questions, please post here:

    https://develop.zendesk.com/hc/en-us/community/topics/360000018828-Zendesk-Mobile-SDKs

    If you don't get a timely response, feel free to submit a ticket.

    0
  • raghees
    Comment actions Permalink

    Hi Bryan,

    I am upload a picture through API and it uploaded successfully but when I see that attachment on agent portal it does not show. It seems like a corrupted image.  

    0
  • Bryan - Community Manager
    Comment actions Permalink

    Hi raghees. Can you give a detailed example of the command you're using to upload the file? Know that when uploading an image file, make sure Content-Type: application/binary is used. 

    Also, if you happen to be writing an Apps framework app, files and binary content cannot be uploaded or downloaded via the client.request command.

    0
  • raghees
    Comment actions Permalink

    Thanks Bryan, I am using  'POST /api/v2/uploads.json' command for uploading files which is allowed for end users. I am using a node server to upload images with request client called 'request-promise'  with the header Content-type: application/binary 

    As you have mentioned that binary content cannot be uploaded via client.request command. Is their any example with javascript or any workaround ?

    0
  • Vijay Kumar
    Comment actions Permalink

    Hi Bryan,

    What is the API URL to attach file to ticket. I am trying this api/v2/tickets/{id}/related.json, but couldn't see attachment in ticket. I have followed the sequence like first to upload an attachment and then using the token received, i am calling above mention API.

    0
  • Greg - Community Manager
    Comment actions Permalink

    Hi Vijay Kumar! The endpoint that you're using there is only available for a GET, so you can not attach the attachment token to the ticket with that. You would need to use a create or update type of endpoint, such as this one.

    0
  • Antoine Morel
    Comment actions Permalink

    Hi,

    Is it possible to add an attachment to an internal note - comment ?

    This is my case :

    I have a python program which scans ticket and attachment when a ticket is created. There are files that need to be converted in order for us to work on it. I would like to automate the conversion of the original file by adding a function in the python program which converts the original file and add the converted file to an internal note.

    Is it possible with the API "upload files" ? : https://developer.zendesk.com/rest_api/docs/support/attachments#upload-files

    Is there another way to do it ?

    0
  • Bryan - Community Manager
    Comment actions Permalink

    Hi Antoine Morel -- check out this other community post. It talks about file uploads using Python. Perhaps this would help get you to your next step: Python file upload

    0

Please sign in to leave a comment.

Powered by Zendesk