简体   繁体   English

VSTS获取单个工件REST客户端API

[英]VSTS Get Individual Artifact REST Client API

I have some build artifacts that have some debug information in them that I would like to display in a build summary. 我有一些构建工件,其中包含一些调试信息,我想在构建摘要中显示这些信息。 However, the only APIs I'm seeing for getting artifacts is as a zip file. 但是,我看到的获取工件的唯一API是一个zip文件。 If you go to the artifact screen and explore the artifacts, then copy the download URL, you get an API as: 如果转到工件屏幕并浏览工件,然后复制下载URL,则得到的API为:

https://{account}/_apis/resources/Containers/{container}?itemPath={file_name} HTTPS:// {帐户} / _apis /资源/容器/ {容器} itemPath = {file_name中}?

However, I can't seem to find a REST Client API to utilize this function in my ts script in the extension. 但是,我似乎在扩展程序的ts脚本中找不到REST Client API来利用此功能。

Any thoughts on how to get the actual files from this? 关于如何从中获取实际文件的任何想法? The TS script needs to just grab the file and display it in the browser. TS脚本只需获取文件并将其显示在浏览器中即可。

There isn't such REST client API to do it. 没有这种REST客户端API可以做到。

You can call that API through HTTP request directly. 您可以直接通过HTTP请求调用该API。 To get container's Id, you can use Get build artifacts REST API (in resource > data value). 要获取容器的ID,可以使用“ 获取构建工件” REST API(在资源>数据值中)。

There is an article about make http request. 有一篇关于make http请求的文章。

5 Ways to Make HTTP Requests in Node.js 在Node.js中发出HTTP请求的5种方法

On the other hand, you don't need to do it through extension, just call Logging Command (call command during build/release) to add additional information to build/release summary. 另一方面,您不需要通过扩展来做到这一点,只需调用Logging Command (在构建/发布期间调用命令)即可将其他信息添加到构建/发布摘要中。 ( ##vso[task.uploadsummary]local file path ) ##vso[task.uploadsummary]local file path

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

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