Purchase prices
Your catalog records what you pay for each product: its purchase price, per
vendor. What the product sells for follows from it and the margins of your
company sites: every product lists that in sellingPrices, one entry per site,
net and gross. Setting prices needs the write:materials scope.
There are three ways to set a new purchase price:
| Your system knows … | Use |
|---|---|
| our id of the product | PATCH /v1/materials/{type}/{id} |
| the manufacturer's article number | PATCH /v1/materials/{type}?manufacturerArticleNumber=… |
| a whole price list of one vendor | POST /v1/materials/purchase-prices/import |
{type} is the material type: pv-modules, batteries, inverters,
wallboxes, equipment, misc, subconstruction or emergency-powers.
One product
curl -X PATCH https://sdgctoqabgledxcjnpsl.supabase.co/functions/v1/api/v1/materials/pv-modules/150 \
-H "Authorization: Bearer mds_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "purchasePrice": { "pricePerPiece": 105.5, "vendorName": "Solar-Großhandel Schmidt" } }'
The answer is the product with its new purchasePrice and the sellingPrices
that follow from it.
Misc materials and mounting systems are also priced per PV module of an offer.
For them, purchasePrice takes a pricePerModule as well; leave it out to keep
the current one:
curl -X PATCH https://sdgctoqabgledxcjnpsl.supabase.co/functions/v1/api/v1/materials/subconstruction/9 \
-H "Authorization: Bearer mds_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "purchasePrice": { "pricePerPiece": 150, "pricePerModule": 32, "vendorName": "Solar-Großhandel Schmidt" } }'
Without our id, use the manufacturer's article number instead. Add
manufacturerId when two manufacturers use the same number:
curl -X PATCH "https://sdgctoqabgledxcjnpsl.supabase.co/functions/v1/api/v1/materials/inverters?manufacturerArticleNumber=SUN2000-10KTL-M1" \
-H "Authorization: Bearer mds_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "purchasePrice": { "pricePerPiece": 1499, "vendorName": "Solar-Großhandel Schmidt" } }'
If several active products have that number, the call answers
409 ambiguous_key and message lists their ids.
A whole price list
The import takes up to 200 rows per call and finds each product without its
type: by the vendor's article number first, then by the manufacturer's. Try it
with dryRun: true first: nothing is written, and you see how each row would
match.
curl -X POST https://sdgctoqabgledxcjnpsl.supabase.co/functions/v1/api/v1/materials/purchase-prices/import \
-H "Authorization: Bearer mds_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"vendorName": "Solar-Großhandel Schmidt",
"dryRun": true,
"rows": [
{ "vendorArticleNumber": "A09402", "manufacturerArticleNumber": "A-MAH54Mb-445", "pricePerPiece": 98.5 },
{ "vendorArticleNumber": "W-11873", "manufacturerArticleNumber": "SUN2000-10KTL-M1", "pricePerPiece": 1499 }
]
}'
Each row gets a status:
status | Meaning |
|---|---|
updated | The price was written. |
matched | The price would be written (dry run). |
unmatched | No active product has the row's article numbers. |
ambiguous | Several products match; candidates lists them. Add manufacturerId. |
error | Writing failed; see message. |
Rows are handled one by one: a failing row does not undo the others. Once a product has a price from the vendor with the vendor's article number on it, the next list finds it by that number directly.
One price per vendor
A product has one purchase price per vendor, as in the planner. Sending a price updates the price this vendor already has for the product; only a vendor the product has no price from yet gets a new one. Either way the price you sent becomes the one the catalog uses.
- Vendor name: matched ignoring upper and lower case and spaces at the start or end, nothing else. "Schmidt GmbH" is not "Schmidt": write the name as it is in the planner.
- Vendor article number: if you send one, the vendor's price with that number is updated. A price of the vendor without a number takes it. If the vendor's prices only have other numbers, it counts as another article of the vendor and gets a price of its own.
- Fields you leave out (
vendorLink,vendorArticleNumber) keep their value;nullclears them.
What happens to offers
Offers you already made keep their prices: every offer line carries the price it was sold at. New offers, and products put on an offer from now on, use the new price.