Get Item Ids |
Scroll |
This call will retrieve the unique item id (GUID) for each line item from the Business Central API.
Method: GET
Endpoint: https://api.businesscentral.dynamics.com/v2.0/<environment name>/sandbox/api/v2.0/companies(<company id>)/items
Request Parameters:
Key |
Value |
$filter |
filter |
$select |
āid,number,displayName,unitPriceā |
Click here to show/hide the Request Script
This script will fill the filter variable used in the request parameters. The Items API endpoint from Business Central will return information for all item numbers provided in the filter. Since this filter is transmitted in the request URL it must not get too long. As a precaution, the script stops adding items if the filter exceeds 1000 characters. The gotAllItems variable will be set to false in this case so it will continue requesting the leftover items. The currentLine variable will also be utilized here as it will still hold the correct value when executing this script the second time (or multiple times).
If there are no line items at all, the RESTCall.NextRequest will be set to CreateInvoice. In this case, skip this request and jump directly to creating the invoice in Business Central.
Click here to show/hide the Response Script
This script takes the Item Ids (GUID), as well as the Item Names from the response and saves them in the index data.
If not all Items Ids were received yet ('gotAllItems' is false) RESTCall.NextRequest will be used to execute the 'GetItemIds' call again. Otherwise, it will proceed with the next call (CreateItem).