【问题标题】:VSTS API List Iterations (current timeframe) not working in powershellVSTS API 列表迭代(当前时间范围)在 powershell 中不起作用
【发布时间】:2018-11-15 13:12:50
【问题描述】:

请参阅thisthis 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(Macintosh;Intel Mac OS X 10_10_3)AppleWebKit/537.36(KHTML,如 Gecko)Chrome/44.0 指定 UserAgent。 2403.89 Safari/537.36,但没有工作)或者我做错了什么?

【问题讨论】:

    标签: powershell azure-devops azure-devops-rest-api


    【解决方案1】:

    改用这个网址:

    $getCurrentIterationAPIURL = "https://account.visualstudio.com/project%20name/team/_apis/work/teamsettings/iterations?`$timeframe=current&api-version=4.1"
    

    $ 替换为`$

    【讨论】:

      猜你喜欢
      • 2018-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-24
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 2020-10-18
      相关资源
      最近更新 更多