Using API see all sales orders for a given product/service?

Hi

If I in Dolibarr GUI click “Product|Services” → List → clicks a particular service → “Related items”

then I can see a table with numbers for Proposals, Sales Orders and Invoices.

And if I click either Sales Orders or Invoices then I can see a list of which thirdparties have bought this product. I’d like to be able to pull that information using the API to be able to create class lists without having to do something like:

For all Sale Orders: do
extract_product
extract_participant
extract_participant_dance_role

and then use that to create a class list for our teachers.

At the moment when I have only a few orders it would work acceptable to just run through all orders, but later once we have many orders, including orders for classes that at that point will be in the past, and I don’t care about past classes, only current and future.

But I can not seem to find any “Related items” under orders in the API :frowning: