Hi Team,
I want to create JIRA ticket using the below CRL script by executing form Bamboo task. When we using basic authentication credentials in curl like below, it is creating JIRA ticket fine.
Basic Authentication script, this is working fine.
curl -D- -u abcd:test1234 -X POST --data "{\"fields\":{\"project\": {\"key\": \"HELLOWS\" }, \"summary\": \"${bamboo.planName} - ${bamboo.buildNumber}\", \"customfield_11601\": \"${bamboo.planKey}-${bamboo.buildNumber}\", \"customfield_11600\": \"${bamboo.proj.pom.releaseVersion}\n\", \"description\": \"Link to the build:\n${bamboo.resultsUrl}\n Link to UAT Deployment logs:\n https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSUAT/deployments \n Link to PROD Deployment logs:\n https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSPROD/deployments \n \",\"issuetype\": {\"name\": \"Task\"}}}" -H "Content-Type: application/json" -k https://jira-uat.appD.appZ.com/rest/api/2/issue/
Output: I can see JIRA new ticket created.
But , when I am trying to use Token based authentication in the CURL script, it gives bad substitution error and it is taking other JIRA project key(AUTJT), where I actually trying to create for the JIRA project key "HELLOWS".
CURL Script is:-
curl -D- -u "Authorization: Bearer +ZZx2sJona6Cqeo37KjfvRv" -X POST --data "{\"fields\":{\"project\": {\"key\": \"HELLOWS\" }, \"summary\": \"${bamboo.planName} - ${bamboo.buildNumber}\", \"customfield_11601\": \"${bamboo.planKey}-${bamboo.buildNumber}\", \"customfield_11600\": \"${bamboo.proj.pom.releaseVersion}\n\", \"description\": \"Link to the build:\n${bamboo.resultsUrl}\n Link to UAT Deployment logs:\n
https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSUAT/deployments
\n Link to PROD Deployment logs:\n
https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSPROD/deployments
\n \",\"issuetype\": {\"name\": \"Task\"}}}" -H "Content-Type: application/json" -k
https://jira-uat.appD.appZ.com/rest/api/2/issue/
output:
/bamboo/application-data/temp/RT-AUTJT-JOB1-35-ScriptBuildTask-6485507220746562543.sh: line 1: {"fields":{"project": {"key": "HELLOWS" }, "summary": "Retail Transformation - AutoJIRATicketPlan - 35", "customfield_11601": "RT-AUTJT-35", "customfield_11600": "${bamboo.proj.pom.releaseVersion}\n", "description": "Link to the build:\n
https://bamboo-uat.appD.appZ.com/browse/RT-AUTJT-JOB1-35\n
Link to UAT Deployment logs:\n
https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSUAT/deployments
\n Link to PROD Deployment logs:\n
https://bamboo-uat.appD.appZ.com/browse/RT-HELLOWSPROD/deployments
\n ","issuetype": {"name": "Task"}}}: bad substitution
Now, please help me, how to create the JIRA ticket using the token based authentication in the CURL, and also, form where it is referring the other project key?
Thanks,
Dev G