RE: Looking for a Web API solution to disable a business unit.
Hi,
Thank you for your query.
You can simply update the isdisabled field to true of the Business Unit entity (there is no separate function available to set state in Web API).
Here is example request:
PATCH [Organization URI]/api/data/v9.0/businessunits(00000000-0000-0000-0000-000000000001)?$select=name,isdisabled HTTP/1.1
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json
Content-Type: application/json; charset=utf-8
Prefer: return=representation
{"isdisabled":true}
You can also use delete (using DELETE) verb to remove the BU:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/update-delete-entities-using-web-api#basic-delete
DELETE [Organization URI]/api/data/v9.0/businessunits(00000000-0000-0000-0000-000000000001) HTTP/1.1
Content-Type: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0