【问题标题】:AzureDevOps - Issue with Wiki REST APIAzureDevOps - Wiki REST API 问题
【发布时间】:2020-02-28 02:51:30
【问题描述】:

我在 AzureDevops 中遇到了 Wiki API 的问题... 基本上,我需要更新那里的一些可用页面,我收到错误 404。

我的 Wiki 链接类似于:

https://dev.azure.com/{company}/{project}/_wiki/wikis/{MY_REPO_NAME}.wiki/1234/My_page

当我尝试通过 Postman 检索此页面的内容时,我使用地址:

https://dev.azure.com/{company}/{project}/_apis/wiki/wikis/{MY_REPO_NAME}.wiki/pages?path=/1234/My_page&includeContent=True&api-version=5.0

但我收到一条带有 404 的消息:

{
    "$id": "1",
    "innerException": null,
    "message": "Wiki page ‘/1234/My_page’ could not be found. Ensure that the path of the page is correct and the page exists.",
    "typeName": "Microsoft.TeamFoundation.Wiki.Server.WikiPageNotFoundException, Microsoft.TeamFoundation.Wiki.Server",
    "typeKey": "WikiPageNotFoundException",
    "errorCode": 0,
    "eventId": 3000
}

我想我错过了此处提供的 {WikiIdentifier} 部分 https://docs.microsoft.com/pt-br/rest/api/azure/devops/wiki/pages/get?view=azure-devops-rest-5.0#get-page-as-json-with-content 但我不确定...

无论如何,这里有什么想法吗?

非常感谢你们!

【问题讨论】:

  • 我已回滚您的编辑。此处不适合在标题中添加 [SOLVED] 或将解决方案编辑到问题中。如果您找到了想要分享的解决方案,请在下方为此目的提供的空白处写下答案。请参阅Can I answer my own question? 了解更多信息。
  • 您好,很高兴您自己找到了解决方案!正如@Ken White 所说,您介意将您的解决方案转换为以下答案,然后在 2 天后接受吗?我认为其他面临同样难题的 SO 用户会非常感谢您的努力:-)
  • 大家好,抱歉!现在完成! :D

标签: azure-devops-rest-api


【解决方案1】:

我刚刚找到了解决这个问题的方法...只是为了确保没有人会遭受这种情况,我能够使用编码代码 %2F 执行该端点的 GET 和其他动词。例如:

https://dev.azure.com/{company}/{project}/_apis/wiki/wikis/{MY_REPO_NAME}.wiki/pages?path=%2F1234/My_page&includeContent=True&api-version=5.0

另一个项目,如果您在 wiki 页面的标题中使用了空格,请记住将空格替换为 %20。

【讨论】:

    猜你喜欢
    • 2017-10-17
    • 2019-05-22
    • 2020-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2016-02-20
    相关资源
    最近更新 更多