Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Can jira API return the URL of an image in attachments ? Edited

I want to use curl to download the images I have on an issue (as attachments).  The problem is the API doesn't return the URL that leads to these images. 

"content" : "https://INSERTCOMPANY.atlassian.net/secure/attachment/10013/image-20201217-080137.png"

The content field URL returned by the API is not what I'm looking for. When entered in the browser this url downloads the correct image, but since it doesn't actually point towards the image I can't use the curl function on it.

1 answer

0 votes
Prince Nyeche Community Leader Jan 11, 2021

Hi @Liviu Florea 

Welcome to Community! You will need to parse the url in the API to get the right link for you to be able to download attachments.

Hi, 
I'm afraid I'm a bit lost. Can you elaborate on your last answer, maybe provide an example ?

Hi @Liviu Florea 

What endpoint did you use? I would use the GET Issue endpoint if I want to get the full url for an attachment  from an issue then output the result. I can show an example but it's in python would that be preferable?

I have tried using the GET issue and GET attachments endpoints so far. I would appreciate seeing the python example.

Prince Nyeche Community Leader Jan 14, 2021

Hi @Liviu Florea 

I actually have a library where i'm trying to make extracting data from Jira Cloud easier via REST API. Here's an example code to extract attachment information using python and searching with JQL. You can see how I implemented the method here on Github on line 265.


from jiraone import LOGIN, PROJECT

user = "email"
password = "token"
link = "https://yourinstance.atlassian.net"
LOGIN(user=user, password=password, url=link)


if __name__ == '__main__':
# the output of the file would be absolute to the directory where this python file is being executed from
# you can use any valid jql query
jql = "project%20in%20(COM%2C%20PYT)%20order%20by%20created%20DESC"
PROJECT.get_attachments_on_projects(query=jql)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

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