Recompute the purchase recommendations now (tenant:purchase-recommendation:write)
POST /api/trade/v1/purchase-recommendations/recompute
Module: Trade · operationId: recomputePurchaseRecommendations · Tag: Purchasing · Auth: access token (Authorization: Bearer <accessToken>)
Recomputes the tenant's recommendations at once instead of waiting for the background run: open ones get the
current need (or close when it is gone), dismissed ones open again when their need changed; recommendations in a
cart or ordered are never changed. With procurement.autoCart the open recommendations then go into the
automatic cart. Publishes trade.purchase_recommendations.changed when something changed.
This is a heavy operation (it reads every open order, purchase order and stock level of the tenant) and runs
synchronously; call it after bulk changes, not per change – the background run catches up within a minute.
When only filling the automatic cart failed, the recompute stands: 200 with warning.
Responses
- 200 What changed (
application/json) - 401 No valid session or bearer token (no body).
- 403 Missing permission, no active tenant in the token, or a missing CSRF token on a cookie write. (
application/json) - 500 The recompute failed. (
application/json)
Fields of the 200 answer:
closed(integer): Number of recommendations closed.opened(integer): New or reopened recommendations.openedIds(array of string (uuid)): Ids of the recommendations opened.updated(integer): Number of recommendations updated.warning(string): Set (German) when the recompute stands but the automatic cart could not be filled; it is filled on the next run.
Example 200 answer:
{
"closed": 0,
"opened": 1,
"openedIds": [
"6a9b0c1d-2e3f-4a4b-9c5d-7e8f9a0b1c01"
],
"updated": 2
}
Example request
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/purchase-recommendations/recompute' \
-H "Authorization: Bearer $ACCESS_TOKEN"