简体   繁体   English

Azure 使用 rest 的 Devops 阶段构建信息 api 不可用

[英]Azure Devops stage wise build information using rest api not available

I am using rest api to gather some information from azure devops.我正在使用 rest api 从 azure devops 收集一些信息。 I want to get full build results including every stage.我想获得完整的构建结果,包括每个阶段。 But in the documentation it is not available.但在文档中它不可用。 The simple build api call only gives me limited data.简单的构建 api 调用只给我有限的数据。 Is there any way to collect the stage wise information like whether the stage was successful or the start and end time for each stage.有什么方法可以收集阶段信息,例如阶段是否成功或每个阶段的开始和结束时间。

Will be grateful for the help.将不胜感激。

You should first call this url:您应该首先调用此 url:

https://dev.azure.com/<YourOrg>/<Your-project>/_apis/build/builds/<buildid>?api-version=5.1

in links you will find timeline:在链接中,您将找到时间线:

    "_links": {
        "self": {
            "href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/Builds/460"
        },
        "web": {
            "href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_build/results?buildId=460"
        },
        "sourceVersionDisplayUri": {
            "href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/460/sources"
        },
        "timeline": {
            "href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/460/Timeline"
        },
        "badge": {
            "href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/status/30"
        }
    },

and there you will find what you are looking for:在那里你会找到你要找的东西:

{
            "previousAttempts": [],
            "id": "67c760f8-35f0-533f-1d24-8e8c3788c96d",
            "parentId": null,
            "type": "Stage",
            "name": "A",
            "startTime": "2020-04-24T08:42:37.2133333Z",
            "finishTime": "2020-04-24T08:42:46.9933333Z",
            "currentOperation": null,
            "percentComplete": null,
            "state": "completed",
            "result": "succeeded",
            "resultCode": null,
            "changeId": 12,
            "lastModified": "0001-01-01T00:00:00",
            "workerName": null,
            "order": 1,
            "details": null,
            "errorCount": 0,
            "warningCount": 0,
            "url": null,
            "log": null,
            "task": null,
            "attempt": 1,
            "identifier": "A"
        },

You can also refer to the below api, this rest api is grabbed from the browser's Network.也可以参考下面的api,这个rest api是从浏览器的网络中抓取的。

Get https://dev.azure.com/{org}/{pro}/_build/results?buildId={id}&__rt=fps&__ver=2

在此处输入图像描述

Stage results are represented by different numbers ie 0->completed,5->canceled etc.阶段结果由不同的数字表示,即 0->完成,5->取消等。

The disadvantage of this api is that the returned content cannot be read intuitively.这个api的缺点是返回的内容不能直观的阅读。 In contrast, the workaround provided by Krzysztof Madej is more convenient and intuitive相比之下,Krzysztof Madej 提供的解决方法更方便直观

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

相关问题 如何使用 Azure DevOps REST API 运行构建/发布管道 - How to run build/release pipeline using Azure DevOps REST API 有没有什么方法可以使用 REST API 了解并仅获取在 Azure DevOps 管道上出现错误的阶段的日志? - Is there any way to know and get only the log for the stage that had an error on Azure DevOps pipelines using REST API? 新创建的 azure 广告组在 azure devops(rest api)中不可用 - Newly created azure ad group not available in azure devops (rest api) Azure DevOps rest API 的 getWorkItems 未返回所有可用字段 - Azure DevOps rest API's getWorkItems is not returning all available fields 使用 Azure DevOps Rest API 重命名文件 - Renaming a file using Azure DevOps Rest API 使用 Azure DevOps 服务 REST API 的仪表板 - Dashboard using Azure DevOps Services REST API Azure Devops 203 非权威信息同 REST API - Azure Devops 203 Non-Authoritative Information with REST API 在构建过程中使用系统OAuth令牌时,Azure DevOps REST API返回403 - Azure DevOps REST API returns a 403 when using the system OAuth token during a build Azure devops REST API | 内部版本号提取到 txt 文件 - Azure devops REST API | Build Number extract to txt file Azure DevOps REST API:如何获得发布阶段的测试结果? - Azure DevOps REST API: how to get release stage's test results?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM