【问题标题】:Creating pull request using cURL in TFS 2017 (on-premise)在 TFS 2017 中使用 cURL 创建拉取请求(本地)
【发布时间】:2017-09-14 03:21:09
【问题描述】:

我一直在关注 tfs 上的 microsoft 文档 https://www.visualstudio.com/en-us/docs/integrate/api/git/pull-requests/pull-requests https://www.visualstudio.com/en-us/docs/integrate/get-started/rest/basics

所以,我正在尝试使用以下命令通过终端创建pull request。

curl -X POST -k -u myUser:<Personal_Access_Token> -H "Content-Type: application/json" -d '{"sourceRefName": "refs/heads/fte", "targetRefName": "refs/heads/dev", "title": "test api", "description": "another test for pr with rest api", "reviewers": [ { "id":  { null } } ] }' https://<installname>/<Projects>/_apis/git/repositories/<git_repository>/pullRequests?api-version=3.0-preview

但是服务器没有返回任何东西

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:05:00 --:--:--     0
curl: (28) Operation timed out after 300453 milliseconds with 0 out of 0 bytes received

不过,我可以使用 curl 命令在 TFS 服务器上执行 GET resquest(例如:列出项目/存储库等)。但POST 似乎不起作用。

注意:我不确定在哪里可以找到 tfs 中的 reviewer id (guid),所以我将其分配为 null。我希望这不会引起这里的问题。

感谢任何建议/解决方案。

【问题讨论】:

  • 澄清:我提到“我可以使用 curl 命令在 TFS 服务器上执行 GET resquest(例如:列出项目/存储库等)。但 POST 似乎不起作用。” ...查看我的终端历史记录,与 POST 不同,我为 GET 使用了正确的端点

标签: rest curl tfs


【解决方案1】:

这是我对 https 端点的一个愚蠢错误。我在尝试使用 https 时指定了端口 8080。所以格式错误的端点看起来像

https://somename.com:8080/blah

我改成

https://somename.com/blah

成功了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-02
    • 2018-02-13
    • 1970-01-01
    • 2015-01-19
    • 2023-04-04
    • 2014-01-16
    • 1970-01-01
    • 2021-10-15
    相关资源
    最近更新 更多