首页 文章

如何使用REST API为TFS 2015 on pre instance获取服务 endpoints 列表?

提问于
浏览
0

我正在使用基于REST的API为TFS 2015获取服务 endpoints 列表(根据reference) . 但在提取信息时遇到问题 .

我们有一个TFS 2015(版本14.102.25423.0)的现场实例 . 下面是我试图获取服务 endpoints 列表的URL .

https://tfs-on-prem-instance/DefaultCollection/product-name/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1

Error:

In Browser

{"count":1,"value":{"Message":"An error has occurred."}}

In PowerShell

调用-RestMethod:{ “计数”:1, “值”:{ “消息”: “发生错误 . ”}}在d:\的DevOps \ TFS \ TFSServiceModule.psm1:75字符:23 ... $结果=调用-RestMethod - 方法获取-uri $ URI -Credential $ ...中房~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpW ebRequest)调用-RestMethod],引发WebException FullyQualifiedErrorId:WebCmdletWebResponseException ,Microsoft.PowerShell .Commands.InvokeRestMethodCommand

谁能告诉我怎样才能解决这个问题?或者请参考一些其他文档来完成 .

2 回答

  • 1

    您可以先通过Get a team project rest API获取项目的ID,然后使用项目的ID通过Service Endpoints API获取服务 endpoints . 所以URL应该是这样的:

    http://tfsinstance/CollectionName/**PROJECTID**/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1
    
  • 2

    我已经使用TFS 2015 Update 3(14.102.25423.0)进行了测试,但在运行下面的api时也出现错误:

    Get http://tfsserver:8080/tfs/CollectionName/TeamProjectName/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1
    

    此API适用于VSTS和TFS 15 RC 2,但不适用于TFS 2015.3 . 我已经在下面的网站上提交了反馈,你可以投票给它:

    https://connect.microsoft.com/VisualStudio/feedback/details/3111161

相关问题