I have a Power Automate workflow that is doing a lot of different things, and at the end, it tries to delete a Team Site (site collection) in my SharePoint Online tenant. I am using an HTTP action to do this, and it looks like this:
Site Address: https://xxx.sharepoint.com/sites/yyy
Method: POST
Uri: _api/web
Headers:
"accept": "application/json;odata=verbose"
"content-type": "application/json;odata=verbose"
"X-HTTP-Method": "DELETE"
The error is
{
"error": {
"code": 502,
"source": "flow-apim-msmanaged-na-westus-01.azure-apim.net",
"clientRequestId": "1ed0536f-78f3-45cc-a636-a10af5d670f0",
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "Cannot delete top-level site: https://xxx.sharepoint.com/sites/yyy.\r\nclientRequestId: 1ed0536f-78f3-45cc-a636-a10af5d670f0\r\nserviceRequestId: 668965a0-c019-2000-72ee-7660a568e911",
"source": "https://xxx.sharepoint.com/sites/yyy/_api/web",
"errors": [
"-2146232832",
"Microsoft.SharePoint.SPException"
]
}
}
}
Is this possible from Power Automate, and if so, what should I be doing differently?