Skip to main content

Products

The PostAddProduct endpoint is responsible for registering a new product in the MIMS system. The registration can be viewed on screens CAD022 and CAD223.


How to register a product​

HTTP POST Request

Request TypeExample URL
POST{{url_base}}/PostAddProduct
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddProduct"

Input Parameters​

ParameterTypeRequiredDescription
ProductNoString(25)YesExternal code of the product
NameString(60)YesProduct description
ReducedNameString(28)YesReduced product description
ProductionCodeString(10)NoProduct code in production
MaterialNoString(25)YesExternal code of the material
PackageNoString(25)YesExternal code of the package
FamilyNoString(25)YesExternal code of the product family
BrandNoString(25)YesExternal code of the brand
AnimalTypeNoString(25)YesExternal code of the animal type
IntegrationNoString(25)NoProduct integration code
UnitMeasurementNoString(25)NoExternal code of the piece unit of measurement
BillingUnitMeasurementNoString(25)NoExternal code of the billing unit of measurement
ValidityRuleNoString(25)NoExternal code of the validity rule
ExpirationDaysIntegerNoNumber of days of the product validity
LabelTemplateCodeIntegerNoLabel template
PreIdentificationLabel
TemplateCode
IntegerNoPre-Identification label template
PrimaryLabelTemplateCodeIntegerNoPrimary label template
ConditionConditionProductYesEnumerator with possible values for Product Condition: cdFresh (Fresh), cdDeepChill (Chilled) or cdFrozen (Frozen)
SpeciesSpeciesProductYesEnumerator with possible values for Product Species: spcWhole (Whole), spcCut (Cut), spcGiblets (Giblets), spcByProduct (By-Product) or spcOther (Other)
RawMaterialStateRawMaterialStateProductYesEnumerator with possible values for Product State: mspInNatura (In Natura) or mspSazonado (Seasoned)
EAN13String(13)NoEAN 13 code
EAN14String(14)NoEAN 14 code
MaxTolerancePercentageFloatNoMaximum tolerance percentage
MinTolerancePercentageFloatNoMinimum tolerance percentage
AnimalsInPackageQtyIntegerNoQuantity of animals in package
ProductInPackageQtyIntegerNoQuantity of products in package
MaximumCapacityFloatNoMaximum Capacity
AverageCapacityFloatNoAverage Capacity
MinimumCapacityFloatNoMinimum Capacity
StandardCapacityFloatNoStandard Capacity
ProductBranchListProductBranchListYesObject containing product information by branch
OverwriteIfExistsBooleanNoFlag indicating that data should be overwritten if the record already exists
Note
  • The product validity can be informed either by the ValidityRuleNo parameter or by the ExpirationDays parameter; at least one of them must be informed. When both are sent, ValidityRuleNo takes precedence. When ExpirationDays is informed, the system looks for a validity rule registered in days with that same quantity and, when none is found, automatically registers a new rule with that number of days.
  • In the parameters LabelTemplateCode, PreIdentificationLabelTemplateCode and PrimaryLabelTemplateCode, we validate if the passed value is greater than 0 and check the existence only of labels that have a code greater than or equal to 1000, as these are the labels that have a record in the "VW_ETIQUETA" view. If the label is not registered, we generate the exception "The label "[value sent in request]" provided was not found!"
  • In the parameters FamilyNo, BrandNo and AnimalTypeNo, when the request is a product modification and the provided value equals the standard integration text (defined in the StandardIntegration variable of the INI file), the system does not update the value of these fields. In these cases, the existing value in the product registration will be maintained.
  • Make sure that the parameters ProductNo, MaterialNo, PackageNo, FamilyNo, BrandNo, AnimalTypeNo and other external codes are valid and not duplicated in the MIMS system.

📝 ProductBranchList Object​

The ProductBranchList object represents a list of product information by branch.

Input Parameters​

ParametersTypeRequiredDescription
BranchNoString(25)YesExternal code of the branch
NameString(120)NoProduct description in the branch
ProductionGroupNoString(25)NoExternal code of the production group
ProductionStructureNoString(25)NoExternal code of the default production structure the product can be produced in
WarehouseNoString(25)NoExternal code of the warehouse
ClassifierGridNoString(25)NoExternal code of the classifier grid
UnitMeasurementNoString(25)NoExternal code of the piece unit of measurement
UnitMeasurementIndi
UnitNo
String(25)NoExternal code of the individual unit unit of measurement
StockSequestrationDaysIntegerNoStock sequestration days
ToleranceStandardDateDaysIntegerNoStandard date tolerance days
DefaultQuantityinPalletIntegerNoDefault quantity of packages for pallet assembly
UnidPartQtyIntegerNoQuantity of pieces per unit
AnimalsInPackageQtyIntegerNoQuantity of animals in package
ProductInPackageQtyIntegerNoQuantity of products in package
MinRawMaterialPercentageFloatNoMinimum raw material product percentage
WeightToleranceUpon
GroupedWeighingPercentage
FloatNoWeight tolerance percentage in Grouped Weighing
MaxTolerancePercentageFloatNoMaximum weight tolerance percentage
MinTolerancePercentageFloatNoMinimum weight tolerance percentage
LabelTemplateCodeIntegerNoLabel Template
PreIdentificationLabel
TemplateCode
IntegerNoPre-Identification Label Template
PrimaryLabelTemplateCodeIntegerNoPrimary Label Template
RegisterAgricultureMinistryCodeString(14)YesAgriculture Ministry registration number
AgricultureMinistryNameString(180)YesDescription in Agriculture Ministry
IdentifiesTypeIdentifiesTypeNoEnumerator with possible values for Product Identification Type: itOpticalReading (Optical Reading) or itManualTyping (Manual Typing)
DispatchTypeDispatchTypeYesEnumerator with possible values for Product Dispatch Type: dtOpticalReading (Optical Reading), dtManualDispatching (Manual Dispatch), dtAutomaticDispatching (Automatic Dispatch) or dtInBulk (In Bulk)
OwnProductionOwnProductionYesEnumerator with possible values for Own Production: opYes (Yes), opNo (No) or opBoth (Both)
IsInactiveBooleanNoFlag indicating that the product is inactive
IsTunnelControlDisabledBooleanNoFlag indicating that Tunnel Control is Inactive
ControlsSecondaryMaterial
Traceability
BooleanNoFlag indicating that the product controls secondary material traceability
PrimaryTareFloatNoAdditional primary tare of the product in the branch
UpdatePrimaryTareBooleanNoFlag indicating that PrimaryTare must be saved exactly as provided, including zero
OverwriteIfExistsBooleanNoFlag indicating that data should be overwritten if the record already exists
Note
  • In the parameters PreIdentificationLabelTemplateCode and PrimaryLabelTemplateCode, we validate if the passed value is greater than 0 and check the existence only of labels that have a code greater than or equal to 1000, as these are the labels that have a record in the "VW_ETIQUETA" view. If the label is not registered, we generate the exception "The label "[value sent in request]" provided was not found!"
  • In the parameters ClassifierGridNo, WarehouseNo and ProductionGroupNo, when the request is a product modification and the provided value equals the standard integration text (defined in the StandardIntegration variable of the INI file), the system does not update the value of these fields. In these cases, the existing value in the product registration will be maintained.
  • The ProductionStructureNo parameter links the product to the production structure it can be produced in. The provided structure must belong to the branch provided in BranchNo.
  • In the parameter ControlsSecondaryMaterialTraceability, when the request is a product modification and secondary material traceability control is already active in the branch, the system does not disable this control, even if the provided value is false. In other words, in a modification, this control can only be enabled through the API.
  • In the parameters PrimaryTare and UpdatePrimaryTare, by default the primary tare is only saved when the provided value is greater than zero; otherwise, on a modification the current value is kept and on an insertion zero is saved. To save the value exactly as provided (including zero, to reset the tare), send UpdatePrimaryTare as true.

Return​

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard WebService response information in method execution
ProductCodeIntegerYesInternal product code generated in the MIMS system

Request Example​

curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddProduct"' \
--header 'Content-Type: application/json' \
--data '{
"ProductNo": "PROD001",
"Name": "Nome do produto Teste",
"ReducedName": "Produto Teste",
"ProductionCode": "FRG001",
"MaterialNo": "MATE123",
"PackageNo": "EMBA123",
"FamilyNo": "FAMI123",
"BrandNo": "MARC123",
"AnimalTypeNo": "TPAVE123",
"IntegrationNo": "INT123456",
"UnitMeasurementNo": "UN",
"BillingUnitMeasurementNo": "UN",
"ValidityRuleNo": "VALI123",
"LabelTemplateCode": 5011,
"PreIdentificationLabelTemplateCode": 5014,
"PrimaryLabelTemplateCode": 5015,
"Condition": "cdFresh",
"Species": "spcCut",
"RawMaterialState": "mspInNatura",
"EAN13": "1234567899874",
"EAN14": "12345678998745",
"MaxTolerancePercentage": 85,
"MinTolerancePercentage": 60,
"AnimalsInPackageQty": 10,
"ProductInPackageQty": 30,
"MaximumCapacity": 100,
"AverageCapacity": 50,
"MinimumCapacity": 20,
"StandardCapacity": 60,
"OverwriteIfExists": true,
"ProductBranchList":[
{
"BranchNo": "BR001",
"Name": "Produto Exemplo - Filial",
"ProductionGroupNo": "GRP001",
"ProductionStructureNo": "EST001",
"ClassifierGridNo": "CLF001",
"WarehouseNo": "WH001",
"UnitMeasurementNo": "UND001",
"UnitMeasurementIndiUnitNo": "UNDIND001",
"StockSequestrationDays": 7,
"ToleranceStandardDateDays": 3,
"DefaultQuantityinPallet": 20,
"UnidPartQty": 10,
"AnimalsInPackageQty": 5,
"ProductInPackageQty": 50,
"MinRawMaterialPercentage": 1.5,
"WeightToleranceUponGroupedWeighingPercentage": 2.0,
"MaxTolerancePercentage": 4.0,
"MinTolerancePercentage": 1.0,
"LabelTemplateCode": 1000,
"PreIdentificationLabelTemplateCode": 1001,
"PrimaryLabelTemplateCode": 1002,
"RegisterAgricultureMinistryCode": "REG1234567890",
"AgricultureMinistryName": "Ministério da Agricultura - Unidade Exemplo",
"IdentifiesType": "itOpticalReading",
"DispatchType": "dtAutomaticDispatching",
"OwnProduction": "opYes",
"IsInactive": false,
"IsTunnelControlDisabled": false,
"ControlsSecondaryMaterialTraceability": false,
"PrimaryTare": 0.05,
"UpdatePrimaryTare": false,
"OverwriteIfExists": true
}
]
}'

Response Example​

{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"ProductCode": 789
}

🐞 Possible Errors​

CodeMessage
APR‑001The provided "External Product Code (ProductNo)" parameter already exists!
APR‑002The provided "LabelTemplateCode" label was not found!
APR‑002The provided "PreIdentificationLabelTemplateCode" label was not found!
APR‑002The provided "PrimaryLabelTemplateCode" label was not found!
APR‑002The provided "PreIdentificationLabelTemplateCode" label was not found!
APR‑003The "Standard Capacity (StandardCapacity)" parameter and the "Average Capacity (AverageCapacity)" parameter were not provided. Provide at least one!
APR‑004The Package "Standard Capacity (StandardCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter!
APR‑005The Package "Average Capacity (AverageCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter!
APR‑006The Package "Maximum Capacity (MaximumCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter!
APR‑007The Package "Standard Capacity (StandardCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter!
APR‑008The Package "Average Capacity (AverageCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter!
APR‑009The Package "Minimum Capacity (MinimumCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter!
APR‑010The "Minimum Tolerance (MinimumTolerancePercentage)" parameter cannot be greater than the "Maximum Tolerance (MaximumTolerancePercentage)" parameter!
APR‑011The "Production Code (ProductionCode)" parameter exceeded the maximum size of "[Maximum number of characters allowed for the product production code]" characters!
APR‑012The "Production Code (ProductionCode)" parameter is already linked to another product!
APR‑013There is a product registration with package ([value sent in request]) and material ([value sent in request]) linked to another external product code ([found external product code])!
APR‑014The "ValidityRuleNo" and the "ExpirationDays" was not informed. Please provide at least one!
APR‑015The informed "ProductNo" ([value sent in request]) is already registered with another material and packaging and it has production registers, so it cannot be changed to the material ([value sent in request]) and the packaging ([value sent in request])!
APR‑016The informed "ProductionStructureNo" ([value sent in request]) belongs to another branch and cannot be linked to the product in the branch ([value sent in request])!
APR‑017The informed branch ([value sent in request]) does not have a registered slaughter unit, so the "ProductionStructureNo" ([value sent in request]) cannot be linked to the product!