Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Access to attachment from REST API

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 Dec 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.

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
DEPLOYMENT TYPE
SERVER
VERSION
8.20.1
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

463 views 3 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you