Dinesh
Dinesh

Reputation: 189

Azure Devops - How to get published information of a wiki page using Rest API

I referred this Microsoft document "MS Rest API documentation for wiki" and was able to get all the pages available in wiki. I was trying to get the published author and published time related information for which there is no available reference.

Is there any Azure DevOps Rest API available to get this information?

Upvotes: 0

Views: 1377

Answers (2)

Simas
Simas

Reputation: 1

You can get commits from specific pages: searchCriteria.itemPath= Here is doc: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-6.0

Wiki page path will be: /WikiName/Folder--Name/Page-Name.md Keep in mind that space in page name or folder name you need to replace with '-'. Also add extension to the page '.md'

Upvotes: 0

Leo Liu
Leo Liu

Reputation: 76760

Azure Devops - How to get published information of a wiki page using Rest API

I am afraid there is no such REST API at this moment, however you can track it by tools such as Fiddler or press F12 in Chrome browser then select Network.

On the web UI, we could access the View revisions of the Wiki:

enter image description here

We could get the history of this Wiki:

enter image description here

Then we press F12 and click the first history, we could get the REST API like below:

https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/<CommitsId>?

enter image description here

But, if we want to automate it by REST API, This seems impossible at the moment.

To automate it, we need to get the first commit ID for the Wiki, I could use the REST API:

https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/?

Now, I could get the all the commits, but those commits for all Wiki files, and there are no other parameters that can be used to filter out which wiki document the commit is associated with. So, we could not get the first commit for each wiki automatically. That is the current limitation.

Hope this helps.

Upvotes: 1

Related Questions