Hi,
You're looking at the right concept, but there is an important distinction here.
Dataverse Web API does support $batch requests using multipart/mixed with a boundary. However, if Server.Connector.HttpClient.PostAsync() only supports application/json, text/html, and application/x-www-form-urlencoded, then it isn't a suitable mechanism for sending a native Dataverse $batch request because the required multipart/mixed content type cannot be constructed through that method.
For 2,000–5,000 records, I would avoid trying to send everything as one request anyway. A few options are worth considering:
- Dataverse Web API
$batch – appropriate when you can make the HTTP request directly and construct the required multipart payload correctly. Use smaller batches rather than one huge request.
- ExecuteMultiple / SDK-based approach – if you're working from server-side .NET code with the Dataverse SDK, this can be a better fit for bulk Create/Update/Delete operations.
- Upsert where appropriate – if the operation is essentially synchronizing records, Upsert can simplify the server-side logic.
- Controlled batching + retry logic – regardless of the approach, process records in manageable batches and handle throttling/transient failures with retry/backoff.
Also keep in mind that $batch doesn't necessarily mean the operations are executed as one atomic transaction. If you require transactional behavior across multiple operations, that's a separate consideration and you may need a changeset.
So your understanding of the multipart/mixed; boundary=... header is correct. The limitation you're seeing is with the particular HttpClient.PostAsync() abstraction, not with Dataverse $batch itself.
If you're implementing this in a Dataverse plug-in/custom server-side component, I'd also consider whether making thousands of Web API calls from the server is the best architecture. The Dataverse SDK's bulk-operation capabilities may be more appropriate for this scenario.