1

I'm building a margin-monitor for exact-online, for this I need to fetch all of the products, sales price and sales prices for a specific price-list.

So far I've managed to get the products and default sales prices via the REST-API. However, getting all the relevant prices for a given price-list still eludes me.

In the frontend, you seem to go to sales -> Price management -> Price lists -> Click the price list -> click the amount of items

This sequence seems to give me a list of items with the pricing I'm looking for.

Screenshot of data needed

However on the API side, I can't seem to make heads or tails from this structure.

Suggesting from the title of the screenshot, I need to get /api/v1/{division}/sales/SalesPriceListPeriods. Yet this just returns the periods of the price lists.

/api/v1/{division}/sales/SalesPriceLists returns the actual price-lists. Ok, that's clear enough.

But what endpoint do I call, and how to receive the actual price for the given price lists?

S.D.
  • 2,486
  • 1
  • 16
  • 23

2 Answers2

1

It used to be SalesPriceListDetails but that one has gone recently. For tables see https://forums.invantive.com/t/foutmelding-itgenoda057-resource-not-found-for-the-segment-salespricelistdetails-the-remote-server-returned-an-error-404-not-found/3601

Guido Leenders
  • 4,232
  • 1
  • 23
  • 43
0

Thanks to @GuidoLeenders for the tip.

In essence, this is the way to work:

  1. Identify your price list via endpoint sales/SalesPriceLists (https://start.exactonline.co.uk/docs/HlpRestAPIResourcesDetails.aspx?name=SalesSalesPriceLists)
  2. Identify the latest valid version of the price lists via endpoint: sales/SalesPriceListPeriods by filtering on your price-list (https://start.exactonline.co.uk/docs/HlpRestAPIResourcesDetails.aspx?name=SalesSalesPriceListPeriods)
  3. Fetch the relevant prices via endpoint sales/SalesPriceListVolumeDiscounts by filtering on the price list period. (https://start.exactonline.co.uk/docs/HlpRestAPIResourcesDetails.aspx?name=SalesSalesPriceListVolumeDiscounts)

If you're using python, I've forked and updated the available package to extend the api wrapper to support these required endpoints. https://github.com/TweaveTech/exactonline

Assuming you have this package already working you can do the following:

pricelist_id = api.salespricelists.all()[0]['ID']
pricelistperiod_id = api.salespricelistperiods.latest(pricelist_id=pricelist_id)['ID']

price_data = api.salespricelistvolumediscounts.filter(pricelistperiod_id=pricelistperiod_id)
S.D.
  • 2,486
  • 1
  • 16
  • 23