VSTS API 列表迭代(当前时间范围)在 powershell 中不起作用
VSTS API List Iterations (current timeframe) not working in powershell
有关背景故事,请参阅 and SO 问题。简而言之,我试图在 current 迭代中使用 powershell 在 VSTS 项目中创建一个错误。
按照文档 here,如果我在 Chrome 中访问此 URL(当然用正确的值替换),我会得到正确的答案。即返回列表的计数为 1,并且数组中只有 1 次迭代 json 序列化对象具有正确的(当前)迭代。
GET https://{accountName}.visualstudio.com/{project}/{team}/_apis/work/teamsettings/iterations?$timeframe={$timeframe}&api-version=4.1
但是,如果我使用 powershell 查询相同的内容,我会得到所有迭代,而不仅仅是当前迭代。
$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 指定一个 UserAgent(Macintosh;Intel Mac OS X 10_10_3) AppleWebKit/537.36(KHTML,如 Gecko)Chrome/44.0.2403.89 Safari/537.36,但没有用)或者我做错了什么?
改用 url:
$getCurrentIterationAPIURL = "https://account.visualstudio.com/project%20name/team/_apis/work/teamsettings/iterations?`$timeframe=current&api-version=4.1"
将$
替换为`$
有关背景故事,请参阅
按照文档 here,如果我在 Chrome 中访问此 URL(当然用正确的值替换),我会得到正确的答案。即返回列表的计数为 1,并且数组中只有 1 次迭代 json 序列化对象具有正确的(当前)迭代。
GET https://{accountName}.visualstudio.com/{project}/{team}/_apis/work/teamsettings/iterations?$timeframe={$timeframe}&api-version=4.1
但是,如果我使用 powershell 查询相同的内容,我会得到所有迭代,而不仅仅是当前迭代。
$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 指定一个 UserAgent(Macintosh;Intel Mac OS X 10_10_3) AppleWebKit/537.36(KHTML,如 Gecko)Chrome/44.0.2403.89 Safari/537.36,但没有用)或者我做错了什么?
改用 url:
$getCurrentIterationAPIURL = "https://account.visualstudio.com/project%20name/team/_apis/work/teamsettings/iterations?`$timeframe=current&api-version=4.1"
将$
替换为`$