简体   繁体   English

Azure DevOps 创建工作项 Rest API 不支持自定义字段?

[英]Azure DevOps Create Work Item Rest API doesn't support custom fields?

I'm using the documentation here: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/create?view=azure-devops-rest-6.0#operation我在这里使用文档: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/create?view=azure-devops-rest-6.0#operation

and seem to be unable to pass data to a fields object.并且似乎无法将数据传递到字段 object。

In my Azure DevOps, I have a custom field on my work items (Epics, tasks, etc.) called SSFKID.在我的 Azure DevOps 中,我的工作项(史诗、任务等)上有一个名为 SSFKID 的自定义字段。

Using Postman, I'm sending the following to the API endpoint.使用 Postman,我将以下内容发送到 API 端点。

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "Sample task 3",
    fields: [
        {"System.SSFKID" : 12345}
    ]
  }
]

I am getting 200 responses, however, when I go to ADO UI and check the work item, the SSFKID field is not populated, so there is probably something wrong with my syntax.我收到 200 条回复,但是,当我 go 到 ADO UI 并检查工作项时,未填充 SSFKID 字段,因此我的语法可能有问题。 I'm not finding any documentation on how to do this.我没有找到任何有关如何执行此操作的文档。 Any assistance?有什么帮助吗?

I think you should use this:我认为你应该使用这个:

new
{
      "op" = "add",
      "path" = "/fields/Custom.SSFKID",
      "from": null,
      "value" = "12345"
},

You should not add this wrong path.您不应添加此错误路径。 You should remove it:你应该删除它:

fields: [
        {"System.SSFKID" : 12345}
    ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Rest API 在 Azure Devops 中创建工作项时出错 - Error while creating Work Item in Azure Devops using Rest API 在 Azure Devops(使用 REST API)中创建拉取请求不会链接工作项 - Creating a Pull Request in Azure Devops (using REST API) doesn't link work items 是否可以在 Azure DevOps 的工作项类型中创建自定义工作项类型? - Is it possible to create a custom work Item type inside work item type in Azure DevOps? 用于创建新 PAT 的 Azure DevOps Rest API - Azure DevOps Rest API to create a new PAT 尝试使用Azure DevOps REST API将讨论'评论'发表到工作项时出错 - Error when trying to post a discussion 'comment' to a work item using the Azure DevOps REST API Azure DevOps 权限 - 绕过 REST API 工作项规则 - 引发错误 - Azure DevOps Permission- ByPass rules on work item for REST API - throws error 如何检索链接到特定提交的工作项-Azure Devops REST API - How to retrieve Work Item linked to specific commit - Azure Devops REST API Azure DevOps rest API 的 getWorkItems 未返回所有可用字段 - Azure DevOps rest API's getWorkItems is not returning all available fields Azure Devops Wishlist backlog(StakeHolder 创建工作项,但不要编辑) - Azure Devops Wishlist backlog (StakeHolder create Work Item, but don't edit) 如何使用 Azure DevOps API 将工作项与测试结果相关联? - How to associate a work item with a test result using the Azure DevOps API?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM