- POST [/instances/$INSTANCE]/private/units#
Create a custom measurement unit or reactivate a previously disabled one.
Required permission:
units-writeRequest:
The request must be a UnitAddRequest.
Response:
- 204 No content:
The backend added the unit.
- 400 Bad Request:
The request body is malformed. Returned with
TALER_EC_GENERIC_PARAMETER_MALFORMED.- 404 Not found:
The instance is unknown. Returned with
TALER_EC_MERCHANT_GENERIC_INSTANCE_UNKNOWN.- 409 Conflict:
A built-in unit with the same short name already exists. Returned with
TALER_EC_MERCHANT_GENERIC_UNIT_BUILTIN.- 413 Request entity too large:
The uploaded body is to long, it exceeds the size limit. Returned with an error code of
TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT.- 500 Internal Server Error:
The server experienced an internal failure. Returned with
TALER_EC_GENERIC_DB_STORE_FAILED,TALER_EC_GENERIC_DB_SOFT_FAILUREorTALER_EC_GENERIC_DB_INVARIANT_FAILURE.
interface UnitAddRequest { // Short identifier to reference the unit from products and orders. unit: string; // Human-readable long label (e.g. "kilogram"). unit_name_long: string; // Human-readable short label (e.g. "kg"). unit_name_short: string; // Optional translations for the long label keyed by BCP 47 language tags. unit_name_long_i18n?: { [lang_tag: string]: string }; // Optional translations for the short label keyed by BCP 47 language tags. unit_name_short_i18n?: { [lang_tag: string]: string }; // Defaults to false; set to true to enable fractional quantities. unit_allow_fraction?: boolean; // Fractional precision (0-6). Ignored when unit_allow_fraction is false. unit_precision_level?: Integer; // Defaults to true. unit_active?: boolean; }