How to get attached jira issue file link using Jira service management REST APIs

Hi dev’s

I am trying to get the link of the Jira issue attached document/file using a Jira service management API but it returns content that is not appropriate to me, is there any API or way to get the location or file link? If anyone knows it please help me

Hi @ArshadKhan,

When calling the JSM REST API endpoint to get all the attachments for a request (GET /rest/servicedeskapi/request/{issueIdOrKey}/attachment) in the response payload, in the _links section, you have the links to download the attachment itself (content) or a thumbnail (if applicable):

[...]
    "created":
    {
        "iso8601": "2024-02-27T18:47:25+0100",
        "jira": "2024-02-27T18:47:25.717+0100",
        "friendly": "Today 6:47 PM",
        "epochMillis": 1709056045717
    },
    "size": 336082,
    "mimeType": "image/jpeg",
    "_links":
    {
        "jiraRest": "https://xxxxxxx.atlassian.net/rest/api/2/attachment/10020",
        "content": "https://xxxxxxx.atlassian.net/rest/servicedeskapi/request/10602/attachment/10020",
        "thumbnail": "https://xxxxxx.atlassian.net/rest/servicedeskapi/request/10602/attachment/10020/thumbnail"
    }
}


However, since I don’t know what you are trying to achieve and since I can read:

it returns content that is not appropriate to me

I am not sure if my reply is gonna help. In case it doesn’t, can you kindly provide more details on what you are trying to achieve?

1 Like

Hi @Dario_B ,

thanks for the reply, I am integrating APIs into our project, when the time we get the content of the file, it is given XML format, which is creating an issue when we store it locally.

Hi @ArshadKhan ,

I am still not sure I understand what you are trying to achieve and how.

From what I understand so far, correct me if I am wrong, you have a JSM request with one (or more) attachment(s) and you want to do get the attachment using REST API in order to do something with it, but it is not clear what.

Can you kindly clarify?