Upload local image via Zendesk API | Community
Skip to main content

Upload local image via Zendesk API

  • April 11, 2024
  • 4 replies
  • 0 views

Hello,

I would like to upload local images in Zendesk via the API. Is it possible or an URL is mandatory?

If it's possible,  what type of body have I to send ? via the meythod “Create Image Upload URL and Token”  or an other?

Thank you for your help!

4 replies

Greg29
  • April 11, 2024

Hi Céline! Please take a look at this article for information on how you can upload attachments with our API.


  • Author
  • April 17, 2024

Thank you but I want to have this image directly within my article and not as an attachment.

I succeed to upload a file with Postman (status : 201 ) but the file (a PNG image) is not visible if I tried to attach an attachment on my article or if I tried to insert an image directly within.

If I use the “Create Image Upload URL and Token” request, I have two errors : 

"errors": [

        {

            "title": "Value `undefined` for /content_type is of type `undefined`; expected `one of [image/jpeg, image/png, image/gif]`",

            "code": "TypeError",

            "meta": null

        },

        {

            "title": "Value `undefined` for /file_size is of type `undefined`; expected `integer`",

            "code": "TypeError",

            "meta": null

        }

    ]

For the first, I don't understang because i've already put “image/png”

For the second, an integer is asked but my size image is equal to 2.88kO. How I can manage that?

(i'm sorry i'm a beginner)


Greg29
  • April 22, 2024

The API that you're using is not for help center articles, which is part of your issue. You need to utilize this API for article attachments.


  • Author
  • April 23, 2024

Thank you , but that creates an attachment. Can use an attachment (image for example) directly in the body of my article?