VSTS REST API: 401 未授权工作项 API

VSTS REST API: 401 Unauthorized on work items API

我在尝试查询 VSTS 的 work item API 时收到 401 Unauthorized。例如:

https://{account}.visualstudio.com/DefaultCollection/_apis/wit/workitems/8622

另一方面,我可以很好地查询其他端点,例如:

https://{account}.visualstudio.com/DefaultCollection/_apis/projects

我正在使用 Basic Authentication,根据文档,这应该不是问题。我还允许令牌上的所有范围。

确保您已在清单的范围部分包含 vso.workvso.work_write

参见 the manifest reference 的范围部分。

手动创建 PAT 时,确保启用该 PAT 所需的范围

您无法查询工作项,因为范围 Read 未启用 对于工作项

创建 PAT 时