VSTS API列表迭代(当前时间范围)在Powershell中不起作用 [英] VSTS API List Iterations (current timeframe) not working in powershell
问题描述
请参见此和
See this and this SO question for the back story. In short, I am trying to create a bug in a VSTS project using powershell in the current iteration.
Following the documentation here, if I visit this URL in Chrome (substituted with right values of course) I get the right answer. i.e. the returned list's count is 1 and there is only 1 iteration json serialized object in the the array with the right (current) iteration.
GET https://{accountName}.visualstudio.com/{project}/{team}/_apis/work/teamsettings/iterations?$timeframe={$timeframe}&api-version=4.1
但是,如果我使用powershell进行查询,则会得到所有迭代,而不仅仅是当前迭代.
However, if I use powershell to query the same, I get ALL iterations and not just the current one.
$getCurrentIterationAPIURL = "https://account.visualstudio.com/project%20name/team/_apis/work/teamsettings/iterations?$timeframe=current&api-version=4.1"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $creatorUser,$createrToken)))
$getCurrentIterationResult=Invoke-RestMethod -Method GET -Uri $getCurrentIterationAPIURL -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
这是API方面的错误(基于UserAgent的不同行为,我尝试使用Mozilla/5.0(Macintosh; Intel Mac OS X 10_10_3)AppleWebKit/537.36(KHTML,例如Gecko)Chrome/44.0来指定UserAgent. 2403.89 Safari/537.36,但无法正常运行)还是我做错了什么?
Is this a bug on the API side (different behavior based on UserAgent, I tried to specify a UserAgent with Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36, but didn't work) or what am I doing wrong ?
推荐答案
改为使用以下网址:
$getCurrentIterationAPIURL = "https://account.visualstudio.com/project%20name/team/_apis/work/teamsettings/iterations?`$timeframe=current&api-version=4.1"
将$
替换为`$
这篇关于VSTS API列表迭代(当前时间范围)在Powershell中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!