curl: (6) Couldn't resolve host 'fields'

This question is in reference to Atlassian Developer Documentation: JIRA REST API Example - Edit issues

I'm experimenting with the REST Api described on this page :

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-edit-issues

When I try the first example (Example of assigning an issue to user "harry"), I'm getting following errors :

curl: (6) Couldn't resolve host 'fields'
curl: (3) <url> malformed
curl: (6) Couldn't resolve host 'assignee:name'
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 1
HTTP/1.1 400 Bad Request

 

This is the command I'm sending : 

curl -D- -u %myuser:mypassword% -X PUT --data @data.txt -H "Content-Type: application/json" https://%mycloudurl%/rest/api/2/issue/%myissue%

 

data.txt : 

{
"fields": {
"assignee":{"name":"harry"}
}
}



Does anyone know what I'm doing wrong ?

 

 

2 answers

First problem is curl is not liking your input. Try to redo your input to something more similar to this example,

http://stackoverflow.com/a/29003279

Good luck.

I solved the problem by putting the data directly in the command and by using single quotes. 

Like this :

curl -D- -u %myuser:mypassword% -X PUT --data '{"fields": {"assignee":{"name":"harry"}}}' -H "Content-Type: application/json" https://%mycloudurl%/rest/api/2/issue/%myissue%

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

376 views 1 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you