Search code examples
githubgithub-api

Create an issue with image via GitHub API


I am creating issues with https://developer.github.com/v3/issues/#create-an-issue. Is it possible to attach images to message body?

I tried 'Accept', 'application/vnd.github.v3.html+json'and emmbeded the image as img elment base64 encoded. The image will not show, but the ticket editor shows the img element.


Solution

  • There is no simple solution to this. The official docs say nothing about that which means it's not supported.

    The GitHub.com authentication works based on cookies while the API authentication uses tokens/passwords. That means if you really want to hack the things to upload your image using GitHub, you have to login using a cookie which is probably more difficult than using a third-party image hosting website.

    For example, you could just upload your image to imgur and then add it in the issue body:

    ![image-title](http://i.imgur.com/x....xx.png)
    

    This will anyway be proxied by GitHub proxy and will be served offer HTTPs.