REST API turn on reporting site collection feature

Copper Contributor

We can turn this feature on via PowerShell PnP, but need to do it via PowerAutomate REST API call.

I have the following...see attached image...for our FLOW REST API call.

When I run the FLOW I get:

Error
Action 'Send_an_HTTP_request_to_SharePoint' failed

Invalid request.
clientRequestId: 690efeb4-ddce-49a2-b5d7-58e5e06db54a
serviceRequestId: 94ea649f-80ce-b000-973f-9686227e5f12
1 Reply

@Chip Cooper I think you are missing /feature/add.

 

See here

 

Excerpt:

// Enables site collection feature (Site scoped feature)  
function EnableSiteCollectionFeature(){  
    var featuresURI = sitecollectionURL + "/_api/site/features/add('151d22d9-95a8-4904-a0a3-22e4db85d1e0')"; // Cross-Site Collection Publishing Feature ID  
    $.ajax({  
        url: featuresURI,  
        method: 'POST',  
        headers: {   
            "Accept": "application/json;odata=verbose",  
            "X-RequestDigest": $("#__REQUESTDIGEST").val()   
        },  
        success: function (data) {  
            console.log("Feature Activated");  
        },  
        error: function(data) {  
            console.log(data.responseJSON.error.message.value);  
        }  
    });  
}