Create an issue with image via GitHub API

霸气de小男生 提交于 2019-12-06 19:02:49

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/28703544/create-an-issue-with-image-via-github-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!