Output JSON suitable for BulkDelete WebAPI call
The BulkDelete WebAPI call consumes a JSON serialised query expression. The query expression is slightly non-standard and manual fiddling is required to get the JSON in a format suitable.
In a similar manner to the View->Query Expression and View->SQL Query side panels, it would be great if there were a side panel in FetchXml builder that would display JSON suitable for use in the BulkDelete WebAPI call.
I wrote a blog covering some of the issues that I found: https://philcole.org/post/bulkdelete/
Quite a niche request I know! I may one day have an attempt at it myself, but logging here incase anyone else has the same idea or issue.
Easiest way will be to rely on the FetchXmlToQueryExpressionRequest from the SDK you mentioned in your post (it's the SDK equivalent to this Web API Function)
As you found out the QueryExpression syntax required by the BulkDelete Action is quite different and (considering all the Dataverse types) creating a converter from scratch can be challenging, a built-in function is available so better to use it. As Fetch XML Builder uses the official SDK, a sample code would be:
var request = new FetchXmlToQueryExpressionRequest { FetchXml = "<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="account"><attribute name="name" />" }; var response = (FetchXmlToQueryExpressionResponse)service.Execute(request); string jsonOutput = JsonConvert.SerializeObject(response.Query);
The returned string is compatible (because it is the same ComplexType) with the json required by the BulkDelete Action.