Product
This document explains all the technical information related to UE Product entity
You will learn,
- relations related to product
- API methods related to product.
- Exception Handling.
Entity Relation Diagram – Product
Product Bulk Insert
Product API support to insert products as a bulk, For example you can send a list of product to the product bulk insert endpoint and add to the system
✏️ Bulk insert will accept a List of products, but the count should be not greater than what UE configured, the default bulk insert record count is 50 records
Endpoint : [ PUT: /api/biz/products/?action=bulk-save
]
Request Body :
[{
"PartName": "2150294",
"Name": "TEST_C",
"CostPrice": 100,
"ListPrice": null,
"PriceIncVat": 0,
"PriceExVat": null,
"AverageCost": null,
"ImageFileID": null,
"Description": null,
"VariansParentID": 0,
"Type": 0,
"Unit": null,
"DefaultProductCategoryID": 0,
"CalculateGrossPriceBasedOnNetPrice": false,
"VatTypeID": 11,
"AccountID": 530,
"VatType": null,
"Account": null,
"ProductCategoryLinks": [],
"DimensionsID": null,
"StatusCode": null,
"CustomValues": null,
"ID": 0,"Deleted": false
},
{
"PartName": "2150295",
"Name": "TEST_D",
"CostPrice": 100,
"ListPrice": null,
"PriceIncVat": 0,
"PriceExVat": null,
"AverageCost": null,
"ImageFileID": null,
"Description": null,
"VariansParentID": 0,
"Type": 0,
"Unit": null,
"DefaultProductCategoryID": 0,
"CalculateGrossPriceBasedOnNetPrice": false,
"VatTypeID": 11,
"AccountID": 530,
"VatType": null,
"Account": null,
"ProductCategoryLinks": [],
"DimensionsID": null,
"StatusCode": null,
"CustomValues": null,
"ID": 0,"Deleted": false
}]
Calculate Price
Endpoint : [ POST : /api/biz/products/?action=calculateprice
]
This API endpoint will accept a product object. VATTypeId is mandatory unless it will not return any value for the PriceIncVat Returns same product object with the values for either PriceExVat or PriceIncVat
- PriceExVat: Price without VAT
- PriceIncVat: Price with VAT
<br>
✏️ VAT percentage is retrieved form VatTypePercentage based on VatTypeId.<br>
✏️ VAT Type is associated with the account select, for example each Account may have VAT Type, and user is encouraged to use the same, but can change the default allocated VAT Type <br> <br>
📢 More information please refer VAT Type <br>
📢Check VAT type and Account section for more information
Product Price Calculation Logic
If cost price is 100 and VAT Percentage is 15 % Then price exclude VAT will be 100 and price include value will be 115 • Price include VAT will be calculate automatically
❗ Prerequisites : Company and Authorized header should be in the request check Auth section for more information
Request :
{
"CostPrice": 10000,
"PriceExVat": 10000,
"VatTypeID": 11,
"AccountID": 530
}
Response :
HTTP 200 OK
{
"PartName": null,
"Name": null,
"CostPrice": 10000,
"ListPrice": null,
"PriceIncVat": 11500,
"PriceExVat": 10000,
"AverageCost": null,
"ImageFileID": null,
"Description": null,
"VariansParentID": 0,
------------------
}
Fetch next available product number
Endpoint : [ GET : /api/biz/products/?action=getnewpartname
]
Product number (partName) is unique field , so system always keep the track of what is the next number that available for the new product.
Next product number value will be calculate based on the last product number If last product number added as numeric for example 10001 the system will return 10002 as the next available product number , but if the product number is not numeric for example 100AB system will add "-1" as postfix to the product number and return it in this case the next available number will be 100AB-1 then it will increment (100AB-2,100AB-3 ...)
Navigation Through The Product List
Get First Product From The List
Endpoint : [ GET : /api/biz/products/?action=first
]
This will return the product that is added fist (oldest product record )
Get Last Product From The List
Endpoint : [ GET : /api/biz/products/?action=last
]
This will return the product that is added last (recent product record )
Get Next Product For Given Product ID
Endpoint : [ GET : api/biz/products/{id}?action=next
]
This will return the product that is next to provied product ID
Validation Error Messages
API will return error message with relates http status code
Example scenario, Trying to add product with existing product id (partName)
Validation error messages will be inside validationResults , this will be an array ,use this to get the validation messages send by the API
Standard http error message codes are used in UE API
{
"_validationResults": {
"": [
{
"ID": 69,
"EntityID": 0,
"PropertyName": "",
"EntityType": "Product",
"Message": "Product number/Partname on product must be unique and not empty",
"Level": 30,
"EntityValidationRule": null,
"ComplexValidationRule": {
"EntityType": "Product",
"ValidationCode": 115001,
"Message": "Product number/Partname on product must be unique and not empty",
"System": false,
"Operation": 30,
"Level": 30,
"SyncKey": null,
"ChangedByCompany": false,
"OnConflict": 0,
"ID": 69,
"Deleted": false,
"CreatedAt": null,
"UpdatedAt": null,
"CreatedBy": null,
"UpdatedBy": null
}
}
]
}
}
}