[POST] .../v1/unit/add
Creates a new unit of measure. Use this method to create a unit of measure before assigning it to items or using it in quantity-bearing document operations. It creates one unit and returns new_id after validating a non-empty name up to 10 characters, a non-default type, and an optional description up to 150 characters. The caller must have unit add permission; missing body, invalid fields, denied access, duplicate or storage validation failures, and persistent errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| description | String | Optional | Unit of measure description. |
| name | String | Required | Unit of measure name. |
| type | String | Required | Unit type: non_pcs - non-piece or weighted, pcs - piece. Allowed values: Default, non_pcs, pcs. |
Request Example
{
"name": "pcs",
"type": "pcs",
"description": "Pieces"
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 1
}
}