为什么用于获取 TFVC 变更集的 TFS Rest API 仅返回 256 个项目? [英] Why is TFS Rest API for fetching the TFVC changesets returning only 256 items?

查看:15
本文介绍了为什么用于获取 TFVC 变更集的 TFS Rest API 仅返回 256 个项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么用于获取 TFVC 变更集的 TFS Rest API 仅返回 256 个项目.我尝试使用 $Top 获得超过 256 个结果.但是没用.

Why is the TFS Rest API for fetching the TFVC changesets returning only 256 items. I tried using the $Top to get more than 256 results. But no use.

用于获取 Git 存储库提交的 API 工作正常.

The API for getting Git repository commits is working fine.

我指的是 https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets

示例请求https://tfs.domain.com/tfs/defaultcollection/projectname/_apis/tfvc/changesets?$searchCriteria.fromDate=2016-07-12T17:49:01&$skip=0&$top=500

Sample request https://tfs.domain.com/tfs/defaultcollection/projectname/_apis/tfvc/changesets?$searchCriteria.fromDate=2016-07-12T17:49:01&$skip=0&$top=500

我也试过不使用 $skip 和 $searchcriteria.fromdate.请帮助我了解如何获得所有结果.

I tried without $skip and $searchcriteria.fromdate also. Please help me understand how to get all the results.

推荐答案

我设法解决了这个奇怪的逻辑(感谢你们的 MSFT 伙计们:/).就我而言,我想获取所有变更集.

I managed to resolve this strange logic (thank you MSFT guys you rock :/). In my case I want to get all changesets.

1) 您需要获得前 256 个变更集(我使用 orderby 以防响应顺序不同):

1) you need to get first 256 changesets (I used orderby in case of different order in responses):

<projectName>/_apis/tfvc/changesets?$top=256&orderby=id desc&searchCriteria.itemPath=<your_path>&api-version=1.0

2) 如果您有超过 0 个项目响应,则从响应中获取 changesetNumber 的最后一个值.如果为 0 - 您获得了所有变更集.

2) if you have more then 0 items in response get last value of changesetNumber from response. If 0 - you got all changesets.

3) 从 changesetNumber 开始获取接下来的 256 个项目:

3) get next 256 items starting from changesetNumber:

  <projectName>/_apis/tfvc/changesets?searchCriteria.toId=<changesetNumber>&$top=256&orderby=id desc&searchCriteria.itemPath=<your_path>&api-version=1.0

您需要跳过第一个变更集(您已经拥有此值)作为响应.

You need to skip first changeset (you already have this value) in response.

4) 转到第 2 步

因此您需要将changesetId 替换为createdDate,将searchCriteria.toId 替换为searchCriteria.fromDate.希望我的解决方案对您有所帮助.

So you need to replace changesetId with createdDate and searchCriteria.toId with searchCriteria.fromDate. I hope my solution will help you.

附言我在连接网站上找不到任何反馈.

P.S. I was unable to find any feedback on connect website.

这篇关于为什么用于获取 TFVC 变更集的 TFS Rest API 仅返回 256 个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆