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

REST-API With Bash Edited

Good morning
I am using JIRA in my company.

I've been using JIRA to find out that there is an API and I'm testing it.

I tested using bash to automatically generate JIRA, and I was successful

 

#!/bin/bash

jira_user="id"
jira_pw="pass"
jira_server="jira.test.com"
project="SECURITY"
issuetype="Inquiry"

 

api_data="{\"fields\":{\"project\":{\"key\":\"${project}\"},\"summary\":\"jira test\",\"description\": \"my description\",\"issuetype\":{\"name\":\"${issuetype}\"}}}"

 

 

curl -u "${jira_user}":"${jira_pw}" -w "<%{http_code}>" -H "Content-Type: application/json" https://${jira_server}/rest/api/2/issue/ -X POST --data "${api_data}"


The reason I leave an article is
Assignee can not be specified.

 

 

2 answers

0 votes

Hello,

Do you mean, that you have some kind of error ,when you specify an assignee? What is the error?

api_data="{\"fields\":{\"project\":{\"key\":\"${project}\"},\"summary\":\"my summary\",\"description\": \"my description\",\"issuetype\":{\"name\":\"${issuetype}\"}}}"

Is there an option here to change the assginee?

Is this the right way?

You missed a couple of parenthises

api_data2="{\"fields\":{\"assignee\":{\"name\":\"${assignee}\"}}}

api_data="{\"fields\":{\"project\":{\"key\":\"${project}\"},\"summary\":\"test\",\"description\": \"my description\",\"issuetype\":{\"name\":\"${issuetype}\"}}}"
api_data2="{\"fields\":{\"assignee\":{\"name\":\"${assignee}\"}

 

->

[incle@incle jira]$ ./jira2.sh
./jira2.sh: line 17: unexpected EOF while looking for matching `"'
./jira2.sh: line 18: syntax error: unexpected end of file

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Calling all Jira Cloud users! Give us feedback on our exploration of a new navigation.

Hi everyone! My name’s Matt and I’m a product manager at Atlassian. I work in the navigation & findability space for all our Jira Cloud products. We’ve been working on trying to improve the exp...

811 views 13 12
Join discussion

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