To obtain bin information for a purchase order line item in Business Central using APIs, you will need to follow these steps:
- Retrieve Purchase Order Lines: Use your existing API call to get the purchase order lines along with their associated location details. This is done using the endpoint you mentioned:
GET /api/v2.0/companies({company_id})/purchaseOrders({PO})/purchaseOrderLines?$expand=location. - Access Location Details: After retrieving the location information, you will need to check if there is a specific API endpoint available that allows you to retrieve bin information for that location. Typically, bins are linked to locations, and you may need to query the bins associated with the location separately.
- Check for Bins API: Look for an API endpoint that provides bin details for the specified location. This could be something like
GET /api/v2.0/companies({company_id})/locations({locationId})/bins, depending on the version of the Business Central API you are using.
If the bin codes are not returned in your current API call, you may need to explore the Business Central documentation for any additional endpoints or updates that could provide the bin information you are looking for.
References: