Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Import images to Jira Cloud using API

Thiago Ferreira
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2019

Hello,

I am using Jira cloud and I would like to import my screenshots (of tests results) to Jira by API.

I am using Jenkins, I already tried this code(shell command) but doesn't work to Jira cloud.

curl -D- -u myuser:mypass -X POST -H "X-Atlassian-Token: no-check" -F "file=@tests/files/attachments/SMALL_TXT.txt" http://urljiracloud.net/rest/api/3/issue/XX-1196/attachments

I got this result, but none attachment is added

+ curl -D- -u myuser:mypass -X POST -H X-Atlassian-Token: no-check -F file=@tests/files/attachments/SMALL_TXT.txt http://urljiracloud.net/rest/api/3/issue/XX-1196/attachments
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 2734k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  4 2734k    0     0    4  112k      0  73681  0:00:38  0:00:01  0:00:37 73656
 19 2734k    0     0   19  528k      0   209k  0:00:13  0:00:02  0:00:11  208k
 45 2734k    0     0   45 1248k      0   354k  0:00:07  0:00:03  0:00:04  354k
 83 2734k    0     0   83 2288k      0   504k  0:00:05  0:00:04  0:00:01  504kHTTP/1.1 301 Moved Permanently
Content-Type: text/html
Date: Fri, 08 Mar 2019 11:35:07 GMT
Location: https://urljiracloud.net/rest/api/3/issue/XX-1196/attachments
Connection: Keep-Alive
Content-Length: 0


100 2734k    0     0  100 2734k      0   550k  0:00:04  0:00:04 --:--:--  732k

Does someone know how to import images, files to Jira Cloud?

 

Found the problem:

The problem were the url

http://urljiracloud.net/rest/api/3/issue/XX-1196/attachments

is http but now is using https.

In log returns 301 and show the new url in the log, I learned this now with a colleague.

I hope that can help someone too.

1 answer

0 votes
Andy Heinzer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2019

Hi Thiago,

It looks like you found the solution here was to use HTTPS instead of the http address when making the REST POST call. 

If you would please, add your solution as an answer to the question instead of editing the question itself.  This allows us the ability to mark the question as answered.  This is a better way to help others that might have the same problem later on.  Once an question has an accepted answer, in google search results the title gets a prefix such as 'solved:' before the title of the question.

Thanks

Andy

Suggest an answer

Log in or Sign up to answer