为什么用于获取TFVC变更集的TFS Rest API仅返回256个项目? [英] Why is TFS Rest API for fetching the TFVC changesets returning only 256 items?
问题描述
为什么要提取仅返回256个项目的TFVC变更集的TFS Rest API.我尝试使用$ 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个以上的项,则从响应中获取changeetNumber的最后一个值.如果为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)从changeetNumber开始获取下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.我在连接网站上找不到任何反馈.
P.S. I was unable to find any feedback on connect website.
这篇关于为什么用于获取TFVC变更集的TFS Rest API仅返回256个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!