POST /v2/api/entity/unit_template.200 and stores a blank template — but a meaningful template should send template_name, main_unit_name, unit_small_name, and at least one unit_templates_unit_factors row. Omitted text fields are stored as empty string / null, and active defaults to 0. branch_id and staff_id are assigned automatically (to the active branch and current staff) and normally should be omitted.unit_templates_unit_factors array. Each row defines a derived unit via factor_name, small_name, and the numeric factor (its multiplier relative to the base unit).The sub-unit array key must be unit_templates_unit_factors. A body that sends the children underunit_factorsis accepted (the parent still saves and returns200) but the sub-rows are silently ignored.
curl --location --globoff 'https://.daftara.com/api2/unit_template' \
--header 'Accept: application/json' \
--header 'apikey: ' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"template_name": "Weight",
"active": 1,
"main_unit_name": "gram",
"unit_small_name": "g",
"unit_templates_unit_factors": [
{
"factor_name": "Kilogram",
"factor": 1000,
"small_name": "kg"
},
{
"factor_name": "Megagram",
"factor": 1000000,
"small_name": "Mg"
}
]
}'{
"message": " Unit Template Added Successfully",
"id": 1
}