produceUnit
const url = 'https://app.dev.buildtrace.eu/api/build-orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/produce-unit';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"serialNumber":"example","consumedSerialIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"rawConsumptions":[{"childRevisionId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","lot":"example","quantity":"example"}],"ecoDispositions":[{"ecoId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","disposition":"example","skippedReason":"example"}],"completedStepSequences":[1],"finalTest":{"testPlanId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","testPlanVersion":1,"notes":"example","results":[{"name":"example","valueNum":1,"valueText":"example","passed":true}]}}'};
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/build-orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/produce-unit \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "serialNumber": "example", "consumedSerialIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "rawConsumptions": [ { "childRevisionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "lot": "example", "quantity": "example" } ], "ecoDispositions": [ { "ecoId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "disposition": "example", "skippedReason": "example" } ], "completedStepSequences": [ 1 ], "finalTest": { "testPlanId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "testPlanVersion": 1, "notes": "example", "results": [ { "name": "example", "valueNum": 1, "valueText": "example", "passed": true } ] } }'Required scope: production:write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
Work-instruction steps the builder ticked off. Optional: a unit produced without them is recorded as having no steps reported, which is honest.
The results of the revision’s final test (its effective test plan). The server judges them against the plan’s own limits — the outcome is computed, never taken from the client — and records them as a FINAL inspection of the new unit in the same transaction as producing it, so a unit is never produced while its test record is refused. A FAIL still produces the unit, which the failed inspection quarantines. Required when the revision has a final test, and refused when it has none. Every required check needs a result.
object
The plan the operator ran (EffectiveTestPlan.testPlan.id). With testPlanVersion, a 409 if the plan in force has changed since.
One check’s result, matched to the check by name. A measurement takes valueNum, a pass/fail check takes passed, a text check takes valueText. A result with no value at all is treated as not recorded (allowed for an optional check).
object
Example generated
{ "serialNumber": "example", "consumedSerialIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "rawConsumptions": [ { "childRevisionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "lot": "example", "quantity": "example" } ], "ecoDispositions": [ { "ecoId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "disposition": "example", "skippedReason": "example" } ], "completedStepSequences": [ 1 ], "finalTest": { "testPlanId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "testPlanVersion": 1, "notes": "example", "results": [ { "name": "example", "valueNum": 1, "valueText": "example", "passed": true } ] }}Responses
Section titled “Responses”Created
object
The computed outcome of the final test. NOT_TESTED when the revision has no final test. A FAIL unit is produced and quarantined by its failed inspection.
The FINAL inspection the results were recorded as (absent when NOT_TESTED).
Example
{ "finalTestResult": "PASS"}Bad request
object
Example generated
{ "error": "example"}Unauthorized
Forbidden. Also when a finalTest is sent by a caller who may not record inspections (quality:write).
Not found
object
Example generated
{ "error": "example"}Conflict
object
Example generated
{ "error": "example"}