adjustStock
const url = 'https://app.dev.buildtrace.eu/api/stock/adjust';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"revisionId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","locationId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","lot":"example","delta":"example","uom":"example","reason":"example","expectedOnHand":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.dev.buildtrace.eu/api/stock/adjust \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "revisionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "lot": "example", "delta": "example", "uom": "example", "reason": "example", "expectedOnHand": "example" }'Required scope: inventory:write.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
What the caller believes is on hand for this part, location and lot (in the part’s stock unit, same format as quantities) — the figure the count was compared against. When given and it no longer matches, the adjustment is refused with 409 so a stale delta is never applied.
Example generated
{ "revisionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "lot": "example", "delta": "example", "uom": "example", "reason": "example", "expectedOnHand": "example"}Responses
Section titled “Responses”OK
A revision’s stock (at one location or over all of them). On hand = available + reserved + blocked. A material counts its lots; a serialized part counts its units, as the reorder status does (on hand = AVAILABLE + RESERVED + QUARANTINED units, blocked = QUARANTINED, available = AVAILABLE units not under an open rework; an AVAILABLE unit under an open rework counts as blocked, since a build order can’t reserve it).
object
What a build order can still reserve: on hand less what open build orders hold and less the stock in blocked lots. The same figure reservations and reorder points use.
On-hand stock in lots whose latest lot inspection failed; it can’t be reserved.
Example generated
{ "revisionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "onHand": "example", "available": "example", "blocked": "example"}Bad request
object
Example generated
{ "error": "example"}Unauthorized
Not found
Not enough stock, what is on hand is reserved by open build orders, or on hand no longer matches expectedOnHand
object
Example generated
{ "error": "example"}