无法通过 REST 向 Jira 添加新问题 API
Cannot add new issue to Jira via REST API
我无法使用 Jira rest 创建自定义字段 API,代码如下:
curl -D- -u abc:1234 -X POST https://*******.atlassian.net/rest/api/2/issue --data '
{
"fields": {
"project": {
"key": "HELLOWORLD"
},
"summary": "Test-RestAPI",
"description": "Creating Task using project keys and issue type names using the REST API",
"issuetype": {
"name": "Task"
},
"customfield_10200": { "name": "ABC" },
"customfield_10300": { "name": "ABCD" }
}
}' -H "Content-Type: application/json"
错误如下:
{"errorMessages":[],"errors":{"customfield_10300":"Operation value must be a string"}}
有什么想法吗?
试试这个
"customfield_10300": "ABCD"
根据this document, If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted. If you want to create a custom field, you need to use POST /rest/api/2/field as per mentioned in this part of the API documentation。
请注意,您可以根据预定义的 JIRA 自定义字段类型创建自定义字段。
我无法使用 Jira rest 创建自定义字段 API,代码如下:
curl -D- -u abc:1234 -X POST https://*******.atlassian.net/rest/api/2/issue --data '
{
"fields": {
"project": {
"key": "HELLOWORLD"
},
"summary": "Test-RestAPI",
"description": "Creating Task using project keys and issue type names using the REST API",
"issuetype": {
"name": "Task"
},
"customfield_10200": { "name": "ABC" },
"customfield_10300": { "name": "ABCD" }
}
}' -H "Content-Type: application/json"
错误如下:
{"errorMessages":[],"errors":{"customfield_10300":"Operation value must be a string"}}
有什么想法吗?
试试这个
"customfield_10300": "ABCD"
根据this document, If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted. If you want to create a custom field, you need to use POST /rest/api/2/field as per mentioned in this part of the API documentation。
请注意,您可以根据预定义的 JIRA 自定义字段类型创建自定义字段。