XRay REST API 提示自定义字段格式无效。

huangapple go评论130阅读模式
英文:

XRay REST API says Custom-Field Non-valid Format

问题

这是我用来导入测试结果到Jira中的XRay测试项的请求。

结果如下:

customfield_14000 在我们的Jira实例中定义为 "Capacity Category"。

我尝试使用 "Capacity Category" 而不是 "customfield_14000" 也获得了相同的结果。

其他尝试 - 多部分

我还尝试了 multipart API。

issueFields.json:

{
	"project": {
		"id": "10006"
	},
	"fields": {
		"summary": "new test execution",
		"customfield_14000": [
			"Automation"
		]
	}
}

结果如下:

{
    "error": "Error assembling issue data: project is required"
}

我确保了它是正确的ID。

英文:

Here is the request I make to import a test result into an XRay Test item in Jira.

curl -L 'https://jira.[xyz].com/rest/raven/2.0/import/execution' -H 'Authorization: Basic Z3V5bDoyNDIxQmxlaWdo' -H 'Content-Type: application/json' -H 'Cookie: JSESSIONID=8A29ED3A4C045C60DACF236DAF8EDA9E; atlassian.xsrf.token=BFS8-LR8B-Z1EU-6YVL_f235c7a5028addccb3a41945753385105b205e1b_lin' -d '{
    "tests": [
        {
            "testKey": "NCS-55808",
            "start": "2023-03-09T07:43+23:95",
            "finish": "2023-03-09T07:43+24:95",
            "status": "PASS",
            "comment": "OK",
            "customfield_14000": {
                "id": 14000,
                "value": "Automation"
            }
        }
    ]
}'

The result I get is:

{
    "error": "Error instantiating bean. Field(s) tests -> customfield_14000 do not follow the correct format."
}

customfield_14000 is defined in our Jira instance as "Capacity Category".

I got the same result when trying "Capacity Category" instead of "customfield_14000".

What Else I Tried - Multipart

I also tried the multipart API.

issueFields.json:

{
	"project": {
		"id": "10006"
	},
	"fields": {
		"summary": "new test execution",
		"customfield_14000": [
			"Automation"
		]
	}
}

Result was:

{
    "error": "Error assembling issue data: project is required"
}

And I did verify it is the correct ID.

答案1

得分: 1

已解决:

{
    "fields": {
        "project": {
            "key": "NCS"
        },
        "summary": "新的测试执行",
        "customfield_14000": {
            "value": "自动化"
        }
    }
}
英文:

Solved:

{
	"fields": {
		"project": {
			"key": "NCS"
		},
		"summary": "new test execution",
		"customfield_14000": {
			"value": "Automation"
		}
	}
}

huangapple
  • 本文由 发表于 2023年3月12日 17:12:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712102.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定