我正在尝试使用Python和TFS REST API在内部TFS上移动文件;服务器似乎仅支持最新的API版本2,但在MSDN上,我找不到v4.1以下版本的任何文档。
我发布到的URL是https://<server>/tfs/<Collection>/<Project>/_apis/tfvc/changesets
目前,我对发布请求的正确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
}
而且对我而言,我在Google上找不到对PathActions的任何引用,不是git而不是tfvc的引用,也不是为此项目提供值的正确方法。
有人通过HTTP请求在TFVC上重命名/移动文件吗?
我偶然想到使用TFS Web界面进行重命名,并浏览浏览器发送的请求。
证明这是正确的格式:
{
"comment": "Moved File",
"changes": [
{
"changeType": 8,
"sourceServerItem": "<old path>",
"item": {
"path": "<new path>",
"version": 470
}
}
]
}