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

Does someone hae good examples of using wget (NOT curl) to create Jira tickets by submitting a JSON file to the Jira server?

J B
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!
February 1, 2017

I can get curl to work fine from my development machine, but for various reasons I need to explore making wget work.  So far I haven't had luck.  I get either a "Bad Request" or "Unsupported Media Type" error.  So I need to know a) if wget can even be used successfully to submit a JSON file of tickets to create and b) some examples of the wget statement that will do it.  Thanks in advance.  --Joe

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
J B
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!
February 3, 2017

Thanks for the response Peter.  I should have included additional detail. 

When I was getting the unsupported media type it was without the --header option.  So then I did the same thing you suggested below, and added the --header=Content-Type:application/json  to my wget call.  That's when the error switched from Unsupported Media Type to BAD REQUEST errors.  See below:

Notes: 

  • Using curl, testfile.json works fine, and creates 2 JIRA tickets, so I am quite certain the format of that file is accurate. 
  • Also using curl, the user name/password and host/port rest address all work fine as well, so I'm quite certain those are all correct 
  • I also tried with and without doublequotes, but got the same results
  • I'm thinking there's some basic problem with the structure of the wget command (that I've only recently tried to learn) that I'm not seeing OR maybe wget doesn't work in general for the purpose of submitting JIRA tickets in a JSON file??? 

 

$ wget --user=username --password=password --post-file=testfile.json --header=Content-Type:application/json  "https://host-address:port/rest/api/2/issue/bulk"

HTTP request sent, awaiting response... 400 Bad Request

2017-02-03 10:27:32 ERROR 400: Bad Request.

 

 

0 votes
Peter Geshev
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.
February 2, 2017

Hi, 

Maybe you need to send additional headers (e.g for the unsupported media type - the application/json Content-Type header). Headers are send with the --header wget option (e.g. 

wget --header=Content-Type:application/json "http://www.example.com:9000/json"

Regards,

Peter

TAGS
AUG Leaders

Atlassian Community Events