post
https://app.fracttal.com/api/service_types/
Create a new service type for the authenticated company.
If the unit specified by unit_code does not exist, it is created automatically using unit_description.
Endpoint
POST /api/service_typesRequest body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
description | Text | Yes | Name of the service type. Maximum 50 characters. |
unit_code | Text | Yes | Code of the unit associated with the service type. Maximum 10 characters. If it does not exist in the company, a new unit is created. |
unit_description | Text | Conditional | Unit description. Required if unit_code does not exist in the company yet. Maximum 50 characters. |
Notes
- The
descriptionandunit_codefields are required. If either one is missing or empty, the function returns code404and the messagedescription and unit_code are required. - If
unit_codedoes not exist in the company unit catalog andunit_descriptionis not sent, the function returns code404and the messageunit_description is required. - The
unit_codelookup is case-insensitive (UPPER). - The new unit is created with
id_unit_type = 2.
Response parameters
| Parameter | Type | Description |
|---|---|---|
id | Integer | Unique identifier of the created service type. |
id_company | Integer | Company identifier. |
description | Text | Registered service type name. |
id_unity | Integer | Identifier of the associated unit. |
is_changed | Boolean | Indicates whether the record has been modified. Always false on creation. |
Example
When the unit does not exist, send unit_description to create it automatically.
{
"description": "Corrective maintenance",
"unit_code": "HRS",
"unit_description": "Hours"
}When the unit already exists, you do not need to send unit_description.
{
"description": "Preventive inspection",
"unit_code": "HRS"
} 200