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

Incle YC Sep 03, 2018

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
Alexey Matveev Community Leader Sep 03, 2018

Hello,

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

Incle YC Sep 04, 2018

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

Is there an option here to change the assginee?

Incle YC Sep 04, 2018

Is this the right way?

Alexey Matveev Community Leader Sep 04, 2018

You missed a couple of parenthises

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

0 votes
Incle YC Sep 04, 2018

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

790 views 0 12
Read article

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