如何使用RESTAPI在JiraServiceDesk中创建问题



我对API的世界完全陌生,并试图使用Jira API在Jira服务台创建一个Issue/Ticket,但即使多次尝试也无法实现。如果有人有命令/代码如何使用bashshell/powershell/python在Jira Service Desk中创建Issue/ticket,这将非常有帮助。

C:Windowssystem32>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:Windowssystem32>

已解决

文件数据中的输入数据

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

卷曲命令:

curl -D- -u user:password -X POST --data-binary "@data"  -H "Content-Type: application/json" https://jiraservicedeskurl/rest/api/2/issue/

最新更新