Search code examples
azure-devops-rest-api

AzureDevOps - Issue with Wiki REST API


I'm facing an issue with the API of the Wiki in AzureDevops... Basically, I need to update some pages available there and I'm receiving an error 404.

My Wiki link is something like:

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

And when I try to retrieve the content of this page trough Postman I use the address:

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

But I'm receiving a message with 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
}

I think I'm missing the part of the {WikiIdentifier} that is available here https://learn.microsoft.com/pt-br/rest/api/azure/devops/wiki/pages/get?view=azure-devops-rest-5.0#get-page-as-json-with-content but I'm not sure...

Anyway, any idea here?

Thank you very much, guys!


Solution

  • I just found how to solve this... just to make sure no know will suffer this, I was able to execute the GET and other verbs of that endpoint using the encoding code %2F. For example:

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

    Another item, if you used a space in the title of the wiki's page, remember to replace the space by %20.