简体   繁体   English

如何在通过 REST API for Z3A580F1420203677F1ZFZFZ3A580F1420203677F1ZBBCF 服务创建错误时找到发布说明字段的 API 端点

[英]How to find API end point for Release Notes field while creating bug via REST API for Azure DevOps Services

I am trying to add a bug via REST API, but I can't find path for release notes field.我正在尝试通过 REST API 添加一个错误,但我找不到发行说明字段的路径。

I checked official documentation for field list, but there are no info regarding release notes field official documentation link我检查了字段列表的官方文档,但没有关于发布说明字段官方文档链接的信息

Following could should create opertion to insert info into release notes, but the Path is wrong以下可能会创建将信息插入发行说明的操作,但路径错误

patchDocument.Add(
                new JsonPatchOperation()
                {
                    Operation = Operation.Add,
                    Path = "/fields/Microsoft.VSTS.Common.ReleaseNotes",
                    Value = "1"
                }
            );

Is there any unofficial documentation, or some library where I can see list of all available API endpoints for fields?是否有任何非官方文档或某些库,我可以在其中查看字段的所有可用 API 端点的列表?

Short answer - yes.简短的回答 - 是的。 - the link that you have in the question is that API, However, that doc is the API reference for Get Work Item Types operation which contains just an example modelling the sample response one might get, and not the holistic list. - 您在问题中的链接是 API,但是,该文档是获取工作项类型操作的 API 参考,其中仅包含一个示例,对可能获得的示例响应进行建模,而不是整体列表。

Before I begin, I'm assuming that Release Notes is a Custom-defined field here, as I don't see it in the default Work item field index .在开始之前,我假设Release Notes是一个自定义字段,因为我在默认的Work item field index中看不到它。

To know what path for this (custom) field might look like, it'd help to execute the Get Work Item Types API for type bug within the scope of your project, and look at the response.要了解此(自定义)字段的path可能是什么样子,对项目的 scope 中的类型错误执行Get Work Item Types API 会有所帮助,并查看响应。 This is what I got, for example:这是我得到的,例如:

获取工作项类型错误

where "dependsOn" is the custom field that I defined in the process used by my Project.其中“dependsOn”是我在项目使用的流程中定义的自定义字段。

So for creating a bug, I provided the request body in the following format to the Create Work Item API:因此,为了创建错误,我将以下格式的请求正文提供给创建工作项API:

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "Sample Bug"
  },
  {
    "op": "add",
    "path": "/fields/Custom.dependsOn",
    "value": "Auth"
  }
]

and voila, had a bug created.瞧,创建了一个错误。 Hope this helps!希望这可以帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM