【发布时间】:2017-05-10 15:52:17
【问题描述】:
我正在尝试使用 TFS REST API 获取项目集合,如下所示,
curl -u "username@domain.com"[:"personal access token"]
https://tfstracker.visualstudio.com:8080/DefaultCollection/_apis/projects?
api-version=2.0
失败并出现以下错误:
curl: (7) Failed to connect to tfstracker.visualstudio.com port 8080: Operation timed out.
我使用的是在线 TFS,即网页版。
更新1:
尝试按照建议调用 API,但出现以下错误:
curl -u <username>[:<AccessToken>] https://tfstracker.visualstudio.com/DefaultCollection/_apis/projects?api-version=1.0
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://app.vssps.visualstudio.com/_signin?realm=tfstracker.visualstudio.com&reply_to=https%3A%2F%2Ftfstracker.visualstudio.com%2FDefaultCollection%2F_apis%2Fprojects%3Fapi-version%3D1.0&redirect=1&context=eyJodCI6MiwiaGlkIjoiOGE4OWMxODUtNDRjNC00YWRkLWI3ZjgtZWIyNDhiZTIwMjAyIiwicXMiOnt9LCJyciI6IiIsInZoIjoiIiwiY3YiOiIiLCJjcyI6IiJ90#ctx=eyJTaWduSW5Db29raWVEb21haW5zIjpbImh0dHBzOi8vbG9naW4ubWljcm9zb2Z0b25saW5lLmNvbSIsImh0dHBzOi8vbG9naW4ubWljcm9zb2Z0b25saW5lLmNvbSJdfQ2">here</a>.</h2>
</body></html>
更新2: 这是有效的命令
curl -u "username@domain.com:accesstoken" https://tfstracker.visualstudio.com/DefaultCollection/_apis/projects?api-version=2.0
【问题讨论】:
-
您使用的是本地 TFS 还是 VSTS?您想获取团队项目还是项目集合?
-
我正在使用 TFS 在线、团队项目或项目集合 - 任何事情都可以。在 POC 阶段。
标签: tfs azure-devops