如何使用其余的api在Visual Studio Team Foundation Server 2015上移动/重命名文件

问题描述 投票:0回答:1

我试图使用Python和TFS rest API在我们的内部TFS上移动文件,服务器似乎只支持最高版本2的API,但在MSDN上我找不到v4.1以下版本的任何文档

我发布的网址是https:/// tfs /// _ apis / tfvc / changesets

目前我对post请求的正确json正文的最佳猜测如下:

{
    "comment": "moved file",
    "changes": [{
        "changeType": "rename",
        "item": {
            "path": "<filepath>",
            "version": 468,
                    "sourceServerItem": "<filepath>"
        }

    }]
}

但我不能得到一个HTTp错误400错误请求与以下消息

{
  "$id": "1",
  "innerException": null,
  "message": "Exactly one value for PathActions is required.\r\nParameter name: change.SourceServerItem",
  "typeName": "System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
  "typeKey": "ArgumentException",
  "errorCode": 0,
  "eventId": 0
}

而对于我的生活,我找不到谷歌上的PathActions的任何参考,这不是git而不是tfvc,或者是为这个项目提供值的正确方法。

有没有人有办法通过HTTP请求在TFVC上重命名/移动文件?

python json rest api tfvc
1个回答
0
投票

我突然想到使用TFS Web界面重命名并查看浏览器发送的请求。

原来这是正确的格式:

{
  "comment": "Moved File",
  "changes": [
    {
      "changeType": 8,
      "sourceServerItem": "<old path>",
      "item": {
        "path": "<new path>",
        "version": 470
      }
    }
  ]
}
© www.soinside.com 2019 - 2024. All rights reserved.