We are trying to create Jira ticket from Jira REST API. We are reading data from file and that contents we are trying to pass to description field in Jira. Our file contains multiple lines and because of this it is not working.
We suspect that this is not working because of multi line in description field.
<span>curl </span><span>-</span><span>D</span><span>-</span> <span>-</span><span>k </span><span>-</span><span>u user</span><span>:</span><span>pwd </span><span>-</span><span>X POST </span><span>--</span><span>data </span><span>'{"fields": {"project": {"key": "KOSPN"},"summary": "NOCAutomation-EnvName-Issue","description": "'"$(cat /root/ZK/lle/final.txt)"'","issuetype": {"name": "'</span><span>$Issuetype</span><span>'"},"customfield_16103": {"value": "'</span><span>$env</span><span>'"},"customfield_13700": {"value": "'</span><span>$level</span><span>'"},"customfield_16102": {"value": "'</span><span>$Domain</span><span>'"},"customfield_11506": {"value": "'</span><span>$release</span><span>'"},"customfield_11805": {"value": "'"$RequestType"'"},"customfield_12300": {"value": "'"$project"'"},"customfield_21305": {"value": "'</span><span>$No</span><span>'"},"customfield_11804": [{"value": "'</span><span>$Component</span><span>'"}]}}'</span> <span>-</span><span>H </span><span>"Content-Type: application/json"</span><span> https</span><span>://</span><span>jiradc</span><span>.</span><span>test</span><span>.</span><span>com</span><span>:</span><span>8443</span><span>/</span><span>rest</span><span>/</span><span>api</span><span>/</span><span>2</span><span>/</span><span>issue</span>Contents of /root/ZK/lle/final.txt which is used as input to description field
QA02 cncservice ACM_SERVICE_HOST actual value (10.208.4.18) is not matching with expected value (10.208.9.21)
QA02 cncservice SNB_SERVICE_HOST actual value (10.208.99.9) is not matching with expected value (10.208.9.12)
QA02 cncservice XYZ_SERVICE_HOST actual value (10.208.4.118) is not matching with expected value (10.208.9.3)
<span><strong>Error: When i execute the script in debug mode below is what is constructed for CURL command here the description field contains multiple lines hence ticket is not getting created</strong><br></span>
curl -D- -k -u user:passwd -X POST --data '{"fields": {"project": {"key": "KOSPN"},"summary": "NOCAutomation-EnvName-Issue","description": "QA02 cncservice ACM_SERVICE_HOST actual value (<a href="http://10.208.4.18/" target="_blank" rel="nofollow noopener noreferrer">10.208.4.18</a>) is not matching with expected value (<a href="http://10.208.9.21/" target="_blank" rel="nofollow noopener noreferrer">10.208.9.21</a>)<br>QA02 cncservice SNB_SERVICE_HOST actual value (<a href="http://10.208.99.9/" target="_blank" rel="nofollow noopener noreferrer">10.208.99.9</a>) is not matching with expected value (<a href="http://10.208.9.12/" target="_blank" rel="nofollow noopener noreferrer">10.208.9.12</a>)<br>QA02 cncservice ACM_SERVICE_HOST actual value (<a href="http://10.208.4.18/" target="_blank" rel="nofollow noopener noreferrer">10.208.4.18</a>) is not matching with expected value (10.208.9.21)","issuetype": {"name": "Task"},"customfield_16103": {"value": "QA02"},"customfield_13700": {"value": "L1"},"customfield_16102": {"value": "ACT"},"customfield_11506": {"value": "Backlog"},"customfield_11805": {"value": "Environment Issues"},"customfield_12300": {"value": "2018 VGC"},"customfield_21305": {"value": "Yes"},"customfield_11804": [{"value": "accservices"}]}}' -H 'Content-Type: application/json' <a href="https://jiradc.test.com:8443/rest/api/2/issue" target="_blank" rel="nofollow noopener noreferrer">https://jiradc.test.com:8443/rest/api/2/issue</a>
Response is:
<span>HTTP/1.1 400<br>X-AREQUESTID: 327x44020628x4<br>X-ANODEID: pl001367<br>X-XSS-Protection: 1; mode=block<br>X-Content-Type-Options: nosniff<br>X-Frame-Options: SAMEORIGIN<br>Content-Security-Policy: frame-ancestors 'self'<br>X-ASEN: SEN-4259792<br>Set-Cookie: JSESSIONID=30FA54033D0AA6EFA9716EA5C9E69AED;path=/;Secure;HttpOnly<br>X-Seraph-LoginReason: OK<br>Set-Cookie: atlassian.xsrf.token=BOOQ-GGIW-E4RQ-BKG0|119aa3a9b6cd1c35ddacddaf0f8dad1cfd798c26|lin;path=/;Secure<br>X-ASESSIONID: 1ez4fp1<br>X-AUSERNAME: TKMADNI<br>Cache-Control: no-cache, no-store, no-transform<br>Content-Type: application/json;charset=UTF-8<br>Transfer-Encoding: chunked<br>Date: Wed, 08 Aug 2018 10:27:21 GMT<br>Connection: close<br><br>{"errorMessages":["Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@64531914; line: 1, column: 208]"]}+</span>