我正在尝试使用其余 API 从 powershell 创建一个 jira 用户故事。 我想在创建任务时向任务添加智能清单。
将以下 JSON 发送到终结点
{
"fields":
{
"project":
{
"key": "dep"
},
"issuetype":
{
"name": "Story"
},
"summary": "Order: 5, Tasktype: New_table",
"description": "Auto created Jira task for a data taskn ",
"assignee":
{
"key": "da",
"name": "da",
"emailAddress": "da@mycompany.com"
},
"labels": ["DATA"],
"customfield_10001": "DWH-62",
"customfield_10006": 0
"--data": /****************************here i try to add a checklist
{
"- ToDo n+ Checkednx Skippedn~ In Progressn"
},
}'
但我不会工作
错误响应是
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At S:XXXXXX1SIJscriptsjira-test.ps1:49 char:1
+ Invoke-RestMethod -uri $restapiuri -Headers $headers -Method POST - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-
RestMethod], WebException
+ FullyQualifiedErrorId :
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
关于如何实现这一目标的任何建议。
我也有类似的问题。尽管 Atlassian 文档指示您可以在创建问题时创建智能清单,但我无法让它正常工作。我最终所做的是首先创建问题,然后调用以使用清单 API 添加清单,如下所示:
await Client.RestClient.ExecuteRequestAsync(RestSharp.Method.PUT, $"{JiraUri}/rest/api/2/issue/{issue}/properties/com.railsware.SmartChecklist.checklist", ""- Item 1\n- Item 2\n- Item 3\n"");
我在这里找到了文档:https://railsware.atlassian.net/wiki/spaces/CHK/pages/92176610/Jira+REST+API.+Read+Write+checklists
它对我有用。