Jira Integrations- User wants to download the attachments of particular Issue in Appian

Hi Community ,

Downloading the attachments for a Particular issue from JIRA is what the user wants. Using integration, I am retrieving the submitted attachments for a certain Issue from JIRA in Appian (url). Afterwards, when the user clicks on the URL, I trigger the integration to save the document in Appian (Folder) so that the user can download it if the download document link is provided in the UI.


As you can see there are two clicks are happening .

1. While invoking the integration to save the document .
2 .User can download the document if provide download document link in interface.

can we do this whole operation  in single click ?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi ,

    I hope this can be done using document download API. There are few steps we need to do.

    1. Please create document downlaod API.
    2. The parameters required for calling the integration which will return the document will be added in path segments of API url.
    3. Call the integration which will return the document id using the values we get from path and save it in local variable.
    4. then once you get the document, use it in http response body.
    5. Now in the interface, use the API url as SafeLink with parameters added in path.
    6. In single click, document will be downloaded

    Below is the sample code of the Download Document API

    a!localVariables(
    local!pathArray:/*Add required parameters required to call integration in pathSegments*/
    fn!cast('type!{http://www.appian.com/ae/types/2009}Text?list', http!request.pathSegments),
    local!document:/*Call the integration using the parameters in path segments */
    tointeger(index(local!pathArray, 1, null)),
    
    local!extensionWhitelist: {"pdf", "txt", "png", "jpg", "jpeg"},
    if(
    /*
    * The path must be only 1 value, the document ID, and that ID must be a number.
    * Otherwise, we return a 404 Not Found
    */
    or(
    isnull(local!document),
    not(contains(local!extensionWhitelist, document(local!document, "extension")))
    ),
    a!httpResponse(
    statusCode: 404,
    body: "404 Not Found",
    headers: {}
    ),
    a!httpResponse(
    /*
    * If the query parameter "attachment" is set to true,
    * set an HTTP header that tells the client that the body of the response
    * should be downloaded. This overrides the default content-disposition
    * of "inline; filename=<filename>.<extension>". We will automatically
    * set the content-type and length.
    */
    headers: if(
    http!request.queryParameters.attachment,
    a!httpHeader(
    name: "Content-Disposition",
    value: concat(
    "attachment; filename=""",
    document(local!document, "name"),
    ".",
    document(local!document, "extension"),
    """"
    )
    ),
    {}
    ),
    body: todocument(local!document)
    )
    )
    )

  • Hi
    Thanks for your reply ,Can you  guide me little bit more>> on this as i am having below objects

    1. Integration which will return the URL of attachments.
    2. And same URL i will be passing in one of the start process model  which is calling one more integration to save document in Appian .

    now i want to download the document through Web API 

Reply Children
No Data