简体   繁体   English

如何使用用于本地TFS的REST API获取JSON数据

[英]How to get json data using REST API for on-premise TFS

We have on-premise TFS Version 15.105.25910.0 ie TFS 2017 and I am trying to get JSON data (let's say for a given Work Item id). 我们有内部TFS版本15.105.25910.0,即TFS 2017,我正在尝试获取JSON数据(假设给定的工作项ID)。 I am using Postman to send/receive request. 我正在使用邮递员发送/接收请求。
I was having an issue with permission denied then figured out a way to pass Personal access tokens in the request. 我遇到了权限被拒绝的问题,然后想出了一种在请求中传递个人访问令牌的方法。
Our basic TFS Url looks like this: 我们的基本TFS网址如下所示:

http://tfs.blahblah.org:8080/TFS/MyOrgName/Software%20Group


How to correctly get JSON data? 如何正确获取JSON数据?

Reference material used: 使用的参考材料:

Currently I am getting 200 OK status but the content type is HTML which says Javascript is Disabled. 目前,我的状态为200 OK,但是内容类型为HTML,表示Javascript已禁用。 Not sure where the problem is occuring? 不知道问题出在哪里?

Feel free to ask more info if needed. 如有需要,随时询问更多信息。

在此处输入图片说明

First, you are using TFS 2017 RTM version, it's suggested to upgrade to the latest Update 3.1 edition. 首先,您正在使用TFS 2017 RTM版本,建议升级到最新的Update 3.1版本。

Then, please check your Postman's version, make sure you are using the latest version v6.1.4 . 然后,请检查您的Postman版本,确保您使用的是最新版本v6.1.4 You could download the latest version from website below: https://www.getpostman.com/ 您可以从以下网站下载最新版本: https : //www.getpostman.com/

Last, check whether you have correct api. 最后,检查您的API是否正确。 The REST API to get a single work item is as below: 获得单个工作项的REST API如下:

Get http://TFS2017:8080/tfs/DefaultCollection/_apis/wit/workitems/{id}?api-version=3.2

Attach a screenshot of the result in Postman: 将结果的屏幕快照附加到Postman中:

在此处输入图片说明

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

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