How to send one or multiple attachment with rest api when creating issue.
I'm am able to create issue with project id but not getting how to attach file or images when creating issue.
will be gratefull.
Look for "attachments" and POST in the API doc. You'll need to call the post once for each attachment https://docs.atlassian.com/jira/REST/latest/
Thanks Nic Brough,
I tried that but i'm getting error internal server error.
Please see the code & tell me what i'm doing wrong in this.
<script type="text/javascript">
function Upload() {
jQuery.support.cors = true;
var param2 = "{\"file\": \"D:\Vaibhav\Jira_Rest_Api\Uploads\LoanE1.jpg\", \"mimeType\": \"image/jpeg\",\"content:\":\"D:\Vaibhav\Jira_Rest_Api\Uploads\LoanE1.jpg\"}";
$.ajax({
type: "POST",
url: "http://10.0.1.62:1001/rest/api/2/issue/Demo-88/attachments",
dataType: "json",
processData: false,
data: param2,
contentType: "Content-type: multipart/form-data",
success: function (data) {
alert("Data Loaded auth: " + data);
window.open("jira_Login1.htm");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('error in uploading:: ' + errorThrown);
}
});
</script>
You don't seem to be iterating through the attachments, just throwing them all at it in one go. Can you try one at a time?
Yes i tried for only single attachment. I did that by jquery.I pasted the code above . But still getting "internal server error".
Is this server problem or mine don't know?
It looks like you're new here. Sign in or register to get started.