Overview
This API is for posting the consumed items on Production Lots. Lines are created into the Trade Item Consumption Journal, linked to a specific production Lot. Then a user within BC needs to review the journal and post manually.
If a more automated process for inventory changes is required, use the MES Transactions. See chapter MES - Overview
There are 2 endpoints on the same table, both with the fixed filter Entry Type = Consumption:
-
consumptionJournalLinesshows the lines in the consumption journals. The endpoint is read-only. -
addConsumptionJournalLinesis used to create (and change or delete) consumption lines. The journal template, batch and line number are set automatically.
|
Endpoint names |
|
|
Source table |
|
|
Fixed view |
Entry Type = Consumption (both endpoints) |
|
Requests allowed |
|
|
Primary key |
"Journal Template Name", "Journal Batch Name", "Line No." ( |
|
Record ID |
|
|
Child objects |
None |
|
Procedures |
None. In this version, the line is only inserted, then it needs to be posted from within BC. |
The two endpoints do not have the same property list: consumptionJournalLines has templateName, batchName, lineNo, description, tradeItemUnitOfMeasure, unitOfMeasure, tradeItemBarcode, stockCenterCode, locationCode, systemRowVersion and lastModified; only addConsumptionJournalLines has productionDate. The property tradeItems is Trade Items (in tradeItemUnitOfMeasure) on consumptionJournalLines, but Trade Items (Base) (in the base unit of measure) on addConsumptionJournalLines. See the Field List below.
Creating lines
When a line is created with POST on addConsumptionJournalLines:
-
The line is added to the first non-recurring Trade Item Journal Template of type Consumption and its first non-recurring batch. The line number is the last line number in the batch + 100 (100 for the first line).
-
postingDateis set to today if it is not given. -
lotandstage(the production lot and stage) must be populated before the item is selected, i.e. they come beforeitemNumberin the request. -
If
useTradeItemStageanduseTradeItemLineidentify an open trade item, the data of that trade item (item, lot, quantities, location etc.) are assigned to the line. Values given forquantityandtradeItemsin the request are applied again afterwards. -
tradeItemson this endpoint is in the base unit of measure of the item. -
Then the line must have a TI (Base) UoM Code, else it will not be possible to post it.
Possible errors (in the order they are checked):
-
No non-recurring Trade Item Journal Template of type Consumption, or no non-recurring batch in it: the standard Business Central "no record within the filter" error.
-
The line has no TI (Base) UoM Code (from
Rec.TestField("TI (Base) UoM Code")): the standard Business Central TestField error, e.g.TI (Base) UoM Code must have a value in Trade Item Journal Line: Journal Template Name=CONSUMP, Journal Batch Name=DEFAULT, Line No.=200. It cannot be zero or empty.
After the lines have been created, a user within BC needs to review the journal and post it.
Data
Field List
The tags show which properties can be given in POST and PATCH requests on addConsumptionJournalLines. On consumptionJournalLines (GET only) all properties are read-only.
Some fields that are marked mandatory may be skipped in the request without getting an error, but when the line is going to be posted, the posting method will return an error.
|
Property |
Type |
Format |
Description |
|
|
|
string |
uuid |
The system id of the record. |
Record ID non-editable |
|
|
string |
max 10 |
Needs to exist in the Trade Item Journal Templates list Only on |
primary key non-editable |
|
|
string |
max 10 |
Needs to exist in the Trade Item Journal Batches list Only on |
primary key non-editable |
|
|
number |
integer |
Line number Only on |
primary key non-editable |
|
|
string |
date |
The posting date, if skipped it will get a default value. The default is today. |
optional |
|
|
string |
date |
Production Date Only on |
optional |
|
|
string |
max 20 |
The production lot Consumed to TI Lot. Must be given before |
mandatory |
|
|
string |
max 20 |
The processing stage to post the consumption on. Consumed to Stage. Must be given before |
mandatory |
|
|
string |
max 20 |
The item needs to be either a WIP item or a Product item. |
mandatory |
|
|
string |
max 20 |
To relate to a specific trade item, the Stage |
optional |
|
|
number |
integer |
To relate to a specific trade item, the line number |
optional |
|
|
string |
max 20 |
Trade Item Lot Code The lot of the consumed trade item, populated automatically. |
non-editable |
|
|
string |
max 100 |
Description Populated automatically. Only on |
non-editable |
|
|
number |
decimal |
Number of trade items On |
mandatory |
|
|
string |
max 10 |
The unit for the Only on |
non-editable |
|
|
number |
decimal |
Quantity, if given the number of trade items will be calculated. |
optional |
|
|
string |
max 10 |
The unit for the Only on |
non-editable |
|
|
string |
max 22 |
Trade Item Barcode of the consumed trade item. Only on |
|
|
|
string |
max 20 |
Stock Center, must match the lot, if the lot has a specific stock center. Populated automatically. Only on |
non-editable |
|
|
string |
max 10 |
Location Code Populated automatically. Only on |
non-editable |
|
|
number |
integer |
System row version. Increments every time the record is modified. Only on |
non-editable |
|
|
string |
date-time |
SystemModifiedAt (date and time of last change) Only on |
non-editable |
Object Example
Examples
Read consumption journal lines
Read the consumption lines of a production lot
Reads the consumption journal lines of production lot PROD-LOT-1, with only a few properties.
Request:
GET .../consumptionJournalLines?$filter=lot eq 'PROD-LOT-1'&$select=lineNo,postingDate,itemNumber,consumedLot,tradeItems,quantity
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#consumptionJournalLines(lineNo,postingDate,itemNumber,consumedLot,tradeItems,quantity)",
"value": [
{
"@odata.etag": "W/\"JzIwOzExMTg5ODcyMDAwMzUyNTUzMzI0MTswMDsn\"",
"lineNo": 100,
"postingDate": "2026-01-22",
"itemNumber": "0900",
"consumedLot": "LANDING-LOT-1",
"tradeItems": 20,
"quantity": 200
}
]
}
Read one line
Reading one line must be done with the record ID, the systemId.
GET .../consumptionJournalLines(a1bedbfb-6bf8-f011-b02e-b42d5a9dc7e2)
Create, change and delete consumption lines
Create a consumption journal line
To create a new line in the journal, use POST and all necessary values.
Example:
POST .../addConsumptionJournalLines
{
"postingDate": "2026-01-20",
"productionDate": "2026-01-18",
"lot": "LANDING-LOT-1",
"stage": "LANDED",
"itemNumber": "0900",
"tradeItems": 20
}
→ Next step - or any time it suits the user - this journal needs to be posted.
Create a line for a specific trade item
Consumes the open trade item with stage LANDED and line number 10000 into production lot PROD-LOT-1; item, lot and units are taken from the trade item.
Request:
POST .../addConsumptionJournalLines
{
"lot": "PROD-LOT-1",
"stage": "FILLETING",
"useTradeItemStage": "LANDED",
"useTradeItemLine": 10000
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#addConsumptionJournalLines/$entity",
"@odata.etag": "W/\"JzIwOzE2MDQ1NTg4MTkyMDMzNzYxOTA4MTswMDsn\"",
"systemId": "c7d1e2a0-7c10-f111-b02e-b42d5a9dc7e2",
"postingDate": "2026-10-26",
"productionDate": "0001-01-01",
"lot": "PROD-LOT-1",
"stage": "FILLETING",
"itemNumber": "0900",
"useTradeItemStage": "LANDED",
"useTradeItemLine": 10000,
"consumedLot": "LANDING-LOT-1",
"tradeItems": 200,
"quantity": 200
}
Create a line for an item without a base unit of measure
The line gets no TI (Base) UoM Code, so the POST fails and no line is created (the error code is shortened).
Request:
POST .../addConsumptionJournalLines
{
"lot": "PROD-LOT-1",
"stage": "FILLETING",
"itemNumber": "9999",
"tradeItems": 5
}
Response:
{
"error": {
"code": "...",
"message": "TI (Base) UoM Code must have a value in Trade Item Journal Line: Journal Template Name=CONSUMP, Journal Batch Name=DEFAULT, Line No.=200. It cannot be zero or empty."
}
}
Change a line
Changes the number of trade items on a line with PATCH; the If-Match header holds the @odata.etag of the record (the response is shortened).
Request:
PATCH .../addConsumptionJournalLines(c7d1e2a0-7c10-f111-b02e-b42d5a9dc7e2)
If-Match: W/"JzIwOzE2MDQ1NTg4MTkyMDMzNzYxOTA4MTswMDsn"
{
"tradeItems": 150
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#addConsumptionJournalLines/$entity",
"@odata.etag": "W/\"JzIwOzEyMzQ1Njc4OTAxMjM0NTY3ODkwMTswMDsn\"",
"systemId": "c7d1e2a0-7c10-f111-b02e-b42d5a9dc7e2",
...
"tradeItems": 150,
...
}
Delete a line
Deletes a consumption journal line; the response is 204 No Content.
DELETE .../addConsumptionJournalLines(c7d1e2a0-7c10-f111-b02e-b42d5a9dc7e2)
If-Match: *