I am trying to fetch attachment from JIRA using REST API(provide by Jira). But I am not getting the metadeta of attachment and it is giving me only a URL which is also secured. can anyone please help how to get attachment from Jira using REST API?
It looks like this endpoint returns the binary now.
But I have no idea how to convert it into base64
Any idea how to do that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian introduced an experimental endpoint to read attachments.
GET /rest/api/3/attachment/content/{id}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @RishabhT,
Thank you for reaching out to Atlassian Community!
Just to make sure we are on the same page, I would like to confirm if you are using the API mentioned on the documentation below:
curl --request GET \
--url 'https://your-domain.atlassian.com/rest/api/3/attachment/{id}' \
--user 'email@example.com:' \
--header 'Accept: application/json'
If that's the case, I tested here and it shows the correct response.
Would mind sharing with us a screenshot of the response you receive?
Regards,
Angélica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Angelich,
Jira does not provide directly the content of the attachment but the secure URLs of the attachments.
Here my colleague @RishabhT is concerned with the contents of the attachment.
The createmeta request working fine but returning only URLs perhaps we need file actual content in the form of base64/blob of the attachment.
So, Is there a way to fetch the content of the attachment ?
We are getting following response currently.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Merajul Hasan,
Thank you for the details.
I'm afraid this is not possible using API. Blob is recorded in the database which can't be accessed in Jira Cloud.
The only APIs available are the ones from the documentation and none of them returns what you need.
Also, I didn't find any feature request suggesting this ability, so please, feel free to raise one on jira.atlassian.com (project JRACLOUD) adding more details about why this feature is important for your environment.
Regards,
Angélica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it still not possible?
I am also looking for the same, using content URI, I would like to get contents so we can insert that attachment in our system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, there is no solution , u cud not get the content of attachment
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Suraj Rajoria,
Thanks for reaching out to Community!
It's still not possible to get the content of an attachment.
As mentioned in my previous reply, Blob is recorded in the database which can't be accessed in Jira Cloud since it's a restricted function.
Kind regards,
Angélica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Suraj Rajoria
I've found a solution using the atlassian-python-api,
Create an instance on the backend using your username and api key,
I've done it through a FastApi backend on python.
The attachment URLs need to be hit from a seperate route, fetched through sessions looped through in this way:
Here is my route:
Here's the function:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.