i want to pass my variable in to the JSON object of JIRA API . Here i want to pass this variable summary into the fields .
var summary = " Create ticket"
"fields": { "summary": "Summary" ,"issuetype": { "id": "1" }, assignee": { "name": "abc" }, "project": {"id": "23601"} }
Kindly share the format to pass the variable into this JSON .
Thanks in Advance .
I came across this thread while looking for solution to my problem. I am not sure if kmjira was also facing the same problem.
I wanted to define a variable and then use it in the jql search query while running this code via Jenkins build step. I was able to do this the following way. I have used two variables OlderThan and jira_sql. The JSON output will be recorded in file OpenTickets.txt
OlderThan=30
jira_jql="Project = PROJECTNAME AND status not in (closed, resolved, done) AND created < -${OlderThan}d ORDER BY created ASC"
if [[ ! -z "${jira_jql}" ]]
then
curl --location --request POST "https://jira.xyz.com/rest/api/2/search?pretty=true" \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZXRhbzpFdGFvQDEyMw==' \
--data '{
"jql": "'"${jira_jql}"'",
"startAt":0,
"maxResults":1000,
"fields":["key","issuetype","summary","priority","status","created","updated","assignee"]
}' > /tmp/OpenTickets.txt
PS: Posted my solution here so that may be it can help someone else like me.
I find it strange to see this important question not answered even after 10 months!!! I found similar questions in the community, also not answered!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.