1

I am totally new to world of APIs, and trying to create an Issue/Ticket in Jira Service Desk using Jira API, but not able to achieve it even after multiple tries. If someone has command/code how to create Issue/ticket in Jira Service Desk using bash shell/powershell/python, it will be of great help.

C:\Windows\system32>curl -D- -u user:password -X POST --data { "serviceDeskId": "10205", "requestTypeId": "10000", "requestFieldValues": { "summary": "Request JSD help via REST", "description": "Desc Request JSD help via REST" }  -H "Content-Type: application/json" https://jjiraservicedeskurl/rest/api/2/issue/
curl: (6) Could not resolve host: serviceDeskId
curl: (6) Could not resolve host: 10205,
curl: (6) Could not resolve host: requestTypeId
curl: (6) Could not resolve host: 10000,
curl: (6) Could not resolve host: requestFieldValues
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: summary
curl: (6) Could not resolve host: Request JSD help via REST,
curl: (6) Could not resolve host: description
curl: (6) Could not resolve host: Desc Request JSD help via REST
curl: (3) [globbing] unmatched close brace/bracket in column 1
HTTP/1.1 400
X-AREQUESTID: 1037x7716x1
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-ASEN: SEN-L15877282
Set-Cookie: JSESSIONID=9B5B3DA5D899E1897DC909CC57D94F78; Path=/; Secure; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=BK2L-I3HA-D24Q-1X7S_ba3e1671ccd8a2bafa38871b994d5387159243b6_lin; Path=/; Secure
X-ASESSIONID: 16z1cmb
X-AUSERNAME: mill_adv_user_test
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 07 Sep 2020 17:17:14 GMT
Connection: close

{"errorMessages":["Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.catalina.connector.CoyoteInputStream@17a62b93; line: 1, column: 0])\n at [Source: org.apache.catalina.connector.CoyoteInputStream@17a62b93; line: 1, column: 3]"]}
C:\Windows\system32>
2
  • You payload object is invalid as far as json is concerned. Try using {"serviceDeskId": "10205", "requestTypeId": "10000", "requestFieldValues": { "summary": "Request JSD help via REST", "description": "Desc Request JSD help via REST" }}. Might be resolved. Commented Sep 7, 2020 at 17:29
  • Thanks for Pointing out @DebarghaRoy, found missing braces. Commented Sep 7, 2020 at 18:27

1 Answer 1

1

SOLVED

Input Data in a file data

{
    "fields": {
       "project":
       { 
           "key": "TEST"
       },
       "summary": "REST EXAMPLE",
       "description": "Creating an issue via REST API",
       "issuetype": {
           "name": "Incident"
       }
   }
}

Curl Command:

curl -D- -u user:password -X POST --data-binary "@data"  -H "Content-Type: application/json" https://jiraservicedeskurl/rest/api/2/issue/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.