REST API attachments Transfer to JIRA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2018 10:21 AM
Hi,
We have already implemented Snow-JIRA integration and built it by our own not using the John anderson POC for snow-jira integration update set.
Requirement is we want to implement the attachment transfer from Snow to JIRA application using REST API.
I have referred lot of community articles but unable to implement it because JIRA application supports only Multipart/form-data, it will not support Binary data format for attachments.
Anyone if worked please help me with code, how they have implemented would be really helpful for lot developers.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 02:44 AM
Hello Ankur,
I am following the same method as you have shared above.
In HTTP headers,
Content-Diposition ---> form-data,
Content-Type ----> multipart/form-data,boundary=AAA,
X-Atalassian-Token --->no-check
In json body,
I am passing the json body as -
{
"attachments": [{
"content_type": "image/png",
"file_name": "Screenshot (153).png",
"size_bytes ": "137246 ",
"sys_id": "f576b5211b091950f7b82fcde54bcbae"
}]
}
In the status code, I can see 200 as status code, but no attachment being added to Jira
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 08:43 AM
Hi @Ankur Bawiskar ,
We have similar requirement to send attachment to Jira from ServiceNow. I have done configuration by following ur steps as shown below, but still getting 400 error code:
If i remove header x-Atlassian-token from the rest http method, then i'm getting 404 error.
Can you please let me know where i might be going wrong ? and im able to attach documents to jira issue with the same login. and im able to hit and create issue from other api, so there is no problem with user/authentication.
Please let me know if u need any other screenshot to get more idea ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 11:30 PM
Hi @Ankur Bawiskar
Can you please share any sample requests here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2018 05:37 AM
Hi Ankur,
Here is the code i am using to send multipart/formdata.. please help to send attachment to JIRA. i am using attachment api
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var JiraAttachment = new sn_ws.RESTMessageV2('Jira REST API', 'Post Attachment');
JiraAttachment.setEndpoint("http://jira.dev.na.XXXX.biz/rest/api/2/issue/WM-16/attachments");
JiraAttachment.setHttpMethod("post");
JiraAttachment.setMIDServer("USNMIDSRVNDCTEST");
JiraAttachment.setBasicAuth("X987111", "Qscvht@369");
JiraAttachment.getRequestHeader("Content-Type", " multipart/form-data");
JiraAttachment.setRequestHeader('X-Atlassian-Token', 'no-check');
JiraAttachment.setQueryParameter('table_name', 'incident');
JiraAttachment.setQueryParameter('table_sys_id', "0344cd86dbc567c076b17d8bbf961931");
JiraAttachment.setRequestBodyFromAttachment("c23f3c4713696b00926635528144b0fb");
var Attachmentresponse = JiraAttachment.execute();
var AttachmentBodyBody = Attachmentresponse.getBody();
var httpStatus = Attachmentresponse.getStatusCode();
var errorCode = Attachmentresponse.getErrorMessage();
gs.log('****Sendingattach ' + httpStatus + errorCode);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2018 08:38 PM
Hi Harish,
So you are using mid server for this.
Did you check by adding logs in mid server?
Also why you cannot directly consume the JIRA API and why to use mid server since I assume JIRA can be accessed publicly.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader