AzureDevOps-Wiki REST API问题

时间:2019-11-01 20:24:02

标签: azure-devops-rest-api

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

我的Wiki链接类似于:

  

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

当我尝试通过邮递员检索此页面的内容时,我使用以下地址:

  

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
}

我想我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缺少{WikiIdentifier}部分,但我不确定...

反正这里有什么主意吗?

非常感谢你们!

1 个答案:

答案 0 :(得分:0)

我刚刚找到了解决这个问题的方法...只是为了确保不知道会遭受这种痛苦,我能够使用编码代码%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。