|
Http Verb |
POST |
|---|---|
|
Url |
/configurations/characteristics/r1/characteristics |
|
Permissions required |
|
|
Personally Identifiable Information (PII) |
No |
|
Sensitive Information |
No |
|
Last Modified Version |
r1 |
|
Released since |
2024 W1 (FSM 16.0) |
|
Deprecated since |
|
|
Removed since |
|
|
Tech Tags |
MULTILANGUAGE-FIELDS |
Business Logic
This API creates a new characteristic.
Validations
Checks if code, characteristicClass, description, and dataType are not empty or missing. If yes, throw an error BASE_0003.
-
Verifies that a characteristic with the same
codeandcharacteristicClassdoesn't already exist in the system -
It also sets default values for some boolean fields (
meterto false,activeto true,negativeValuesto false,notNullto false) if they are not explicitly provided -
If the inserted
characteristicis marked as a meter (meaningcharacteristic.meter =true), and itsusageis set toOBJECTS_ATTRIBUTES(usageId = 1), then this combination is considered invalid and the error CHAR_005 is thrown. -
If usageId != 1:
-
dataTypeIdmust be eitherDOUBLE(dataTypeId = 8) orNUMBER(dataTypeId = 1 ) . If it's anything else (like text, date, etc.), it throws an error CHAR_002. This means if a characteristic is not an object attribute, it's expected to be a numerical type. -
measureUnitIdisnull, it throws an error CHAR_003. This ensures that any non-object-attribute characteristic (which, as per the previous rule, must be numerical) also has a unit of measurement associated with it (e.g., meters, kilograms, units).
-
-
If
dataTypeIdisDOUBLE(dataTypeId = 8):-
It must have
size,maxLength, andprecisiondefined in the request. If not, it throws an error CHAR_004, error.
-
-
If
dataTypeIdisEURO(dataTypeId = 9 ),VARCHAR(dataTypeId = 2), orNUMBER(dataTypeId = 1)-
It must have
size = nullandmaxLength = null. It must NOT haveprecisiondefined(precision = null). If at least one of those conditions is not met, it throws an error CHAR_004, error. -
If the
dataTypeIdis notNUMBER(meaning it'sEUROwithdataTypeId = 9orVARCHARwithdataTypeId = 2), it must NOT have ameasurementUnitId(measureUnitId = null). If it does, it throws an error CHAR_004, error.
-
-
If
dataTypeIdisCOMBO(dataTypeId = 7 ),BOOLEAN(dataTypeId = 4 ),TIME(dataTypeId = 6 ),DATE(dataTypeId = 3 ), orDATETIME(dataTypeId = 5 ):-
It must NOT have
size,maxLength,precision, ormeasurementUnitIddefined (all of these fieldnull). If any of these are present, it throws an error CHAR_004, error. -
If
dataTypeId is COMBO (dataTypeId = 7 ):-
it must have a
valueDomainIddefined (valueDomainId != null). -
then, it checks if the provided
valueDomainIdactually exists within a list of valid domain values retrieved from the system. IfvalueDomainis missing or not valid, it throws an error CHAR_004, error.
-
-
Header Parameters
Default.
Request Body Parameters
|
Field |
Validations |
Note |
|---|---|---|
|
code |
Not null Max Length: 120 |
|
|
description |
Not null Max Length: 255 |
|
|
active |
Max Length: 1 |
|
|
order |
Max Length: 10 |
|
|
dataTypeId |
Not null Max Length: 10 |
|
|
format |
Max Length: 2048 |
|
|
size |
Max Length: 10 |
|
|
maxLength |
Max Length: 10 |
|
|
notNull |
Max Length: 4 |
|
|
measureUnitId |
Max Length: 10 |
|
|
precision |
Max Length: 10 |
|
|
valueDomainId |
Max Length: 10 |
|
|
characteristicClassId |
Not null Max Length: 10 |
|
|
usageId |
Max Length: 10 |
|
|
meter |
Max Length: 4 |
|
|
negativeValues |
Max Length: 1 |
|
Response documentation
Response payload fields
|
Field |
Note |
|---|---|
|
id |
|
Response error codes
BASE_0003, BASE_0007, CHAR_001, BASE_0001, CHAR_002, CHAR_003,CHAR_004, CHAR_005