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

bash script REST API request problem

summary="Abnormal End"
data=`cat <<EOF
'"fields": {"project":{"key": $key},"summary": $summary,"description": $description,"issuetype": {"name": $name}}'
#echo $data
curl -D- -u user:psswd -X POST --data {$data} -H "Content-Type: application/json" http://localhost:8081/rest/api/2/issue/

Error :

{"errorMessages":["Unexpected character (''' (code 39)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@1616d88; line: 1, column: 3]"]}

I'm trying to write a bash script wich can do REST API request from data of a CSV file. Can someone help me to resolve this error ?

(I need key, summary, description and name fields as variables to use these later import from a CSV file.)

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted

I found the solution with the command eval :

eval curl "-D- -u user:pswd -X POST --data ${data} -H \"Content-Type: application/json\" http://localhost:8081/rest/api/2/issue/"

Having trouble understand how the script should look written out, do I keep the brackets in the script or are they there just for display reasons? Can you provide how this is supposed to look in an executable?



Community showcase
Posted in Europe

Matt Reiner, K15t: Video and Slides online

Today’s guest was Matt Reiner, Customer Advocate at K15t, who showed how to Create Powerful Technical Documentation in Confluence and he probably broke the record for most questions answered, even th...

13 views 0 0
View post

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