Previously I have done it using below SharePoint REST API endpoint and payload with JavaScript:
<button type="button" onclick="SetDefaultPageTemplate()"> Set Default Page Template</button>
<script type="text/javascript" src="/sites/SPConnect/SiteAssets/jquery.min.js"></script>
<script type="text/javascript">
function SetDefaultPageTemplate() {
var webEndpoint = _spPageContextInfo.webAbsoluteUrl + "/_api/web";
//Visual template: ac3c4a88-04f2-4e54-a411-df9899c90df5
var webProperties = {
'__metadata': { 'type': 'SP.Web' },
'DefaultNewPageTemplateId': 'ac3c4a88-04f2-4e54-a411-df9899c90df5'
}
$.ajax({
url: webEndpoint,
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "MERGE",
"If-Match": "*"
},
data: JSON.stringify(webProperties),
success: function(data) {
console.log(data);
},
error: function(error) {
console.log(error);
}
});
}
</script>
Try using REST API endpoint URL and payload like above in your Power automate flow and see if it works for you.
Related Read:
- Set a page template as default page template in SharePoint Online