如何通过 Rest API 添加附件到问题的评论?
我试试这个:
encoderrrr=MultipartEncoder(fields={
'file':('tets.jpg', open('./project/MAC/MAC-338/screenshot-1.png','rb'))
})
auth_login,auth_password ='USER','PASSWORD'
headers = {
'Accept': 'application/json',
'Cache-Control': 'no-cache',
'Content-Type': encoderrrr.content_type}
r = requests.post('https://youtrack.URL.com/api/issues/{}/attachments/{}'.format('MAC-1','4-400'),
auth=HTTPBasicAuth(auth_login,auth_password),
data= encoderrrr,
headers=headers)
print(r.text)
我得到错误
{"error":"Not Found","error_description":"Entity with id 4-400 not found"}
如何发送附件进行评论?