I am trying to add an attachment to already created JIRA issue via JIRA REST api & ionic 3
Here is provider.ts
this.file=$event.target.files[0];
let formData = new FormData();
formData.append('file',this.file);
console.log("formdata = "+formData);
console.log("formdata JSON = "+JSON.stringify(formData));
let request = new XMLHttpRequest();
console.log(JSON.stringify(formData));
request.open('POST', '/rest/api/2'+'/issue/PM-4/attachments');
request.setRequestHeader("X-Atlassian-Token", "nocheck");
request.setRequestHeader('Authorization', "Basic " + btoa("user:password"));
request.setRequestHeader('Content-Type',"multipart/form-data; charset=UTF-8; boundary='mmm';");
request.setRequestHeader("Content-Transfer-Encoding", "binary");
request.setRequestHeader("User-Agent", "xx");
request.setRequestHeader("Content-Disposition", "form-data; name='file';");
request.send(formData);
fileupload.html -->
//---------------------------------------------------
<ion-item>
<ion-input type="file" accept="image/*" (change)="changeListener($event)"> </ion-input>
</ion-item>
fileupload.ts -->
changeListener($event):void{
this.file=$event.target.files[0];
console.log(this.file);
console.log("upload...");
let regData={"file":this.file};
console.log("REGDATAA"+JSON.stringify(regData));
this.jira.postAttachment("PM-3",regData).subscribe(dataa=>{
console.log(dataa);
});
}
in browser console I see that I am getting a response 200 OK but attachment is not uploading and I see an empty JSON array in body response.
I have referred to almost all the posts about the multipart data and naming the file type as "file" etc and so on..
but nothing works from Postman it works perfectly fine, any advice on how to proceed ?
Hello Python Test? Welcome.....? I am sure you a have a real name, unless your parents were super cool and really did name you Python Test!
ANYWAYS!
What version of Jira are you presently running?
I am able to make API calls using CURL to upload attachments over the API. An example call I have is as follows:
-u username:password -X POST -H "X-Atlassian-Token: nocheck" -F "file=@Path\Attachments\FileName.eml" https://
JIRA.ACME.net:8443/rest/api/2/issue/ACME-100/attachments
@NotTheRealStephenSifersNOPENOPENOPENOPEDid you see my whole question ?
I already mentioned the version as 7 and also that it is working via postman (same as curl) but the same doesn't works when I use it in ionic 3(a framework to develop hybrid apps : incase you dont know about it) with exact headers whatever I used in postman/curl
and seriously do you concern about the name here ???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The name part was a joke, I apologize for that. We just like to welcome new members to the community and that name stood out.
I misunderstood the question. Haven't heard of ionic3, let me read up on it.
Just to be clear, this is a community forum and not a support request board. I volunteer with Atlassian to assist in answering questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sounds good (y)
Thanks , but I am sure this is a issue as when I searched in internet there was nothing about it .. and should be addressed for saving much time at-least. would request all community members to have a look.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, upon further reading up I won't be able to test this for you in a timely manner. With that said I would suggest you raise a support issue with Atlassian to get further assistance.
For Developer Support:
(select "Jira API and Add-on development")
https://developer.atlassian.com/help/#requests
For non-Developer level support:
(From the drop down select "Technical issues and bugs")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.