Access to attachment from REST API

abouzy December 14, 2021

Hi,

Our customer initiated migration to Jira Data Center.

We are delivering a product needing to access to attachments in Jira from the REST API.

All other calls with REST API are working on this instance, but when trying to get the content of an attachment (request <server>/secure/attachment/<id>/<file>), instead of getting the content, we get an html page talking about two factor authentication.

Our customer's admin team does not know where this behaviour comes from.

Do you have any clue ?

Regular authentication is basic and works perfectly with any other call on this data center instance.

Same requests to get attachments work perfectly on the Jira server instance of the same customer.

Thanks for help,

Best regards,

Arnaud Bouzy

 

1 answer

0 votes
Artur Moura
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 23, 2021

Hi @abouzy

It seems you are using the wrong REST API call.

For you to be able to get the issue attachments you should use the following endpoint -

<jira URL>/rest/api/2/attachment/<issueid>/<fileid>

 Hoping this helps, please let us know how it goes.

abouzy January 18, 2022

Hi Artur,

when using your address, I get a 404 error. 

I don't know what is the fileid you are talking about (neither attachmentid nor filename works).

The ...secure... address comes from the details of the attachment (field "content").

Best,

Arnaud

Suggest an answer

Log in or Sign up to answer