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

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

XRay REST API says Custom-Field Non-valid Format

问题

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

结果如下:

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

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

其他尝试 - 多部分

我还尝试了 multipart API。

issueFields.json:

  1. {
  2. "project": {
  3. "id": "10006"
  4. },
  5. "fields": {
  6. "summary": "new test execution",
  7. "customfield_14000": [
  8. "Automation"
  9. ]
  10. }
  11. }

结果如下:

  1. {
  2. "error": "Error assembling issue data: project is required"
  3. }

我确保了它是正确的ID。

英文:

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

  1. 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 '{
  2. "tests": [
  3. {
  4. "testKey": "NCS-55808",
  5. "start": "2023-03-09T07:43+23:95",
  6. "finish": "2023-03-09T07:43+24:95",
  7. "status": "PASS",
  8. "comment": "OK",
  9. "customfield_14000": {
  10. "id": 14000,
  11. "value": "Automation"
  12. }
  13. }
  14. ]
  15. }'

The result I get is:

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

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:

  1. {
  2. "project": {
  3. "id": "10006"
  4. },
  5. "fields": {
  6. "summary": "new test execution",
  7. "customfield_14000": [
  8. "Automation"
  9. ]
  10. }
  11. }

Result was:

  1. {
  2. "error": "Error assembling issue data: project is required"
  3. }

And I did verify it is the correct ID.

答案1

得分: 1

已解决:

  1. {
  2. "fields": {
  3. "project": {
  4. "key": "NCS"
  5. },
  6. "summary": "新的测试执行",
  7. "customfield_14000": {
  8. "value": "自动化"
  9. }
  10. }
  11. }
英文:

Solved:

  1. {
  2. "fields": {
  3. "project": {
  4. "key": "NCS"
  5. },
  6. "summary": "new test execution",
  7. "customfield_14000": {
  8. "value": "Automation"
  9. }
  10. }
  11. }

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:

确定