Service Virtualization

Expand all | Collapse all

I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

  • 1.  I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Posted Jul 19, 2018 05:43 AM
      |   view attached

    I am trying to add attachment to JIRA cards using JIRA API, I’m referring below document for addAttachment API.

    https://developer.atlassian.com/cloud/jira/platform/rest/?_ga=2.266257802.480460066.1531821316-547560940.1531821316#api-api-2-issue-issueIdOrKey-attachments-post


    Headers as below:

    X-Atlassian-Token:no-check

    Content-Type:application/json

     

    Request param: file=@C:/Program Files/CA/DevTest/Projects/CHARMR3_API/Tests/Results/get_hier_01_2018-07-05_negative.html

     

    Content Type: multipart/form-data; boundary=--gc0p4Jq0M2Yt08jU534c0p

    As expected API is returning 200 response code but no attachment added to JIRA card. No JSON response as well.


    May be the boundary value I gave in contentType could be wrong. Attached is the HTML file needs to be attached, can anyone please suggest the solution?

     

    I am able to perform few other updates using JIRA APIs mentioned in above shared link.

    Attachment(s)



  • 2.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Broadcom Employee
    Posted Jul 20, 2018 01:04 AM

    Hi,

     

    How does CA DevTest relate your trial with JIRA cards? Do you use REST Invoke API in DevTest?
    We can only find the location of "Request param"'s file seems DevTest installation path.
    What version of DevTest are you using?
    Could you please give us the detail information?

     

    Thank you,



  • 3.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Posted Aug 03, 2018 05:32 AM

    I am using DevTest 9.5.0.54.

    Yes I am using REST invoke API.



  • 4.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Posted Aug 03, 2018 05:31 AM

    Hi, have got the solution to upload file using JIRA API from LISA now. But the file is getting uploaded without content and size is 0. Not sure if need to make any config chnages. below is the request I am sending:

    POST /rest/api/latest/issue/CHARM-6654/attachments HTTP/1.1
    Pragma: no-cache
    Cache-Control: no-cache
    X-Atlassian-Token: nocheck
    lisaFrameRemoteIP: 10.45.186.127
    lisaFrameRoot: true
    lisaFrameID: 1d3b8330-96fa-11e8-b0ca-323920524153
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="file"; filename="get_grp_03_2018-07-03.html"; Content-Type: text/html


    ------WebKitFormBoundary7MA4YWxkTrZu0gW--

     

    same config is uploading file properly when triggered from postman i.e. uploaded with content

     

    Anyone having suggestions?



  • 5.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Broadcom Employee
    Posted Aug 07, 2018 03:50 AM

    Hi,

     

    Thank you for the information.
    How do you send POST request to JIRA API?

     

    Thank you,



  • 6.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Posted Aug 08, 2018 12:58 AM

    Hi Yusuke,

    PFA screenshot of DEVTEST JIRA REST step config.

    I have mentioned above how to send POST request to JIRA API.

    The Jira Cloud platform REST API is the link I am referring



  • 7.  Re: I am trying to add attachment to JIRA cards using JIRA API, I’m referring available document for addAttachment API.   As expected API is returning 200 response code but no attachment added to JIRA card

    Broadcom Employee
    Posted Aug 08, 2018 03:40 AM

    Hi,

     

    Please try "HTTP/HTML request step" on behalf of "REST step" and set the "Host Name:", "Port:", "User:", "Password:" and "Path:"
    Then add one post parameter which is suitable JIRA API

    Maybe
    Key:file
    value:@C:/Program Files/CA/DevTest/Projects/CHARMR3_API/Tests/Results/get_hier_01_2018-07-05_negative.html

    And change the "Form Encoding:" as "multipart/form-data; boundary=----".


    I do not have the access for JIRA and JIRA REST API but I tried REST API in DevTest which would deploy .mar file to VSE and I could deploy the .mar file.
    Here is the screenshot of the "HTTP/HTML request step" in my trial.


    My trial and this screenshot may help you.


    Thank you,