Batch Entries contain all details of an operation run – request, response, used variables, Business Central records, etc. Plus RESTwithUS is using Batch Entries to create the request JSON and process response JSON – so if something goes wrong, this is the best place to have a look.
To view Batch Entries select your operation from the list and open Related / Batch Entries. And from the Connections list you can view Batch Entries related to selected connection with menu action Home / Batch Entries.
Every operation call starts with the following code:
var
OperationID: Enum "Operation ID RWU";
APIScriptRWU.INIT(OperationID::TestProvider_UpdateCustomer);
During this action you are setting the Batch Code for current operation run. If you are using the Operation ID RWU
enum (recommended), RESTwithUS will generate the text batch code from the enum value.
The result will be the same, if you set the batch code as text with the following line of code (but this is recommended for testing purposes only):
APIScriptRWU.INIT('TESTPROVIDER_UPDATECUSTOMER');
You can use whatever string you want – just remember that each new call of an operation deletes all previous Batch Entries with the same Batch Code.
For example, this means that if you use Batch Code TESTPROVIDER_UPDATECUSTOMER
for each Update Customer
operation (with different customers), only the last operation Batch Entries will be saved. This can be intentional, because saving lots of information to Batch Entries may have an impact on performance.
However, if you for example need to save the entire history of customer updates, you can set the Batch Code as following:
APIScriptRWU.INIT('TESTPROVIDER_UPDATECUSTOMER_' + Customer."No.");
Tip: Batch Entries are not the only way to preserve the operations history. You can set up logging up to database or files on a provider level, too.
So what are some useful information that you can find in Batch Entries? Let's have an example of Batch Entries from a PUT
request (update operation):
Request
and Response
parts in Communication Type column.root
and Endpoint
nodes contain information related to the whole request or response like JSON data preview, etc.Header
(note, that the request header are always at the end of request data).Endpoint URL
.As noted before, having lots of Batch Entries may have an impact on performance. For performance heavy operations it is recommended to set the log level in Batch Entries to minimum or even switch the Batch Entries off and use just the provider log files.
Log level is set at operation level. Select your operation from the list, Reopen it and click on Details in menu:
You can now adjust the operation batch entries settings in Log level field:
You can log all details (default option), just some information or even turn Batch Entries off.