Azure DevOps Update Wiki page content

Within Azure DevOps it is possible to create and edit Wiki pages. In this article I will demonstrate how you can update content of such a Wiki page via a Power Automate cloud flow.

testresults_updatewikipagecontent

Inspiration

This question from Jondoesflow:
I am trying to create some content on an ADO wiki page via an HTTP connector.
Power Users Community thread: HTTP call to create content on existing WIKI page.

Request Headers

Like Jon already mentioned you can use a PATCH request for this via the Azure DevOps REST API. That REST API has a Pages – Update method for this. You can interact with that API via the HTTP action of the HTTP connector.

One of the important things to point out is that this request also requires some additional Headers information.

Version of the page on which the change is to be made. Mandatory for Edit scenario. To be populated in the If-Match header of the request.

Flow setup

In this example we are retrieving the page by id and updating the content in a second request. For the Authentication we are using a Personal Access Token.

updatewikipagecontent

1. Add a Manually trigger a flow trigger action.

manuallytriggeraflow

2. Add Get my profile (v2) action (optional).

This action is optional, you can also add the values directly into HTTP actions.

getmyprofile

3. Add three Initialize variables actions (optional).

These actions are optional, you can also add the values directly into HTTP actions.

threevariables_updatewikipagecontent

a. Use the settings from the table below, replace the values with your own specific values. Below are some example values.

NameTypeValue
OrgNameStringFabrikam
ProjectNameStringFabrikamTravel
WikiIdentifierStringFabrikamTravel.wiki

4. Add a HTTP action.
This action is to retrieve the eTag of the Wiki Page with ID 1.

getwikipagebyid

a. Select the GET method
b. Use the URI from the codesnippet below
c. Select Basic for the Authentication, provide the details of username and Personal Access Token.

5. Add a second HTTP action.
This action is to update the content of the Wiki Page with ID 1.

updatewikipagecontent_http

a. Select the PATCH method
b. Use the URI from the codesnippet below
c. Use the Headers from the codesnippet below
d. Use the Body from the codesnippet below
e. Select Basic for the Authentication, provide the details of username and Personal Access Token.

That is it for the setup of this example. Happy testing!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.