The standard (and for what I can see most used) way of using Dynamics 365 Business Central APIs is by sending an HTTP request to the API endpoint for the selected entity one request at a time:
But if you need to perform massive operations (like for example inserting multiple journal lines in a batch) this could be not too much performant.
Dynamics 365 Business Central APIs (standard and custom ones) support batch requests, where you can combine multiple API operations in a single HTTP request (so, a single call with a body that contains an array of operations) and receive as output a single message that contains an array of responses for each operation:
To use batch commands with Dynamics 365 Business Central APIs, you need to send an HTTP POST request to the following endpoint:
If you’re interested on using batch calls with Dynamics 365 Business Central APIs, the “must to read” pages are the AJ’s blog posts starting from here.
What I want to put in evidence here is that batch calls have a limit on the number of operations that you can send in a single call. I’ve received a message from a partner today that from their application they started receiving an error like the following:
"message": "The current batch message contains too many parts. A maximum number of '100' query operations and change sets are allowed in a batch message. CorrelationId: XXX"
This is a “by design” limitation: in a batch call, you cannot send more that 100 operations at a time and you have no way to override this limit (the Microsoft.OData.Core framework has a property called ODataMessageQuotas.MaxOperationsPerChangeset but it’s hidden to you).
The only solution to avoid this error is to split calls into multiple batches if you have more than 100 operations to perform. Please remember this