patch-private-units-UNIT.rst (1902B)
1 .. http:patch:: [/instances/$INSTANCE]/private/units/$UNIT 2 3 Update attributes of a measurement unit. 4 5 **Required permission:** ``units-write`` 6 7 **Request:** 8 9 The request must be a `UnitPatchRequest`. 10 11 **Response:** 12 13 :http:statuscode:`204 No content`: 14 The backend updated the unit. 15 :http:statuscode:`400 Bad Request`: 16 The request body is malformed. 17 Returned with ``TALER_EC_GENERIC_PARAMETER_MALFORMED``. 18 :http:statuscode:`404 Not found`: 19 The unit is unknown to the backend. 20 :http:statuscode:`409 Conflict`: 21 The unit is a builtin unit and cannot be modified. 22 Returned with ``TALER_EC_MERCHANT_GENERIC_UNIT_BUILTIN``. 23 :http:statuscode:`500 Internal Server Error`: 24 The server experienced an internal failure. 25 Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED``. 26 27 Built-in units allow changing ``unit_allow_fraction``, ``unit_precision_level``, and 28 ``unit_active``; other fields are immutable for built-ins. 29 30 .. ts:def:: UnitPatchRequest 31 32 interface UnitPatchRequest { 33 // Updated human-readable long label. 34 unit_name_long?: string; 35 36 // Updated human-readable short label. 37 unit_name_short?: string; 38 39 // Updated translations for the long label keyed by BCP 47 language tags. 40 unit_name_long_i18n?: { [lang_tag: string]: string }; 41 42 // Updated translations for the short label keyed by BCP 47 language tags. 43 unit_name_short_i18n?: { [lang_tag: string]: string }; 44 45 // Override to allow or forbid fractional quantities. 46 unit_allow_fraction?: boolean; 47 48 // Override for the fractional precision (0-6). Ignored if fractions are disabled. 49 unit_precision_level?: Integer; 50 51 // Toggle whether the unit is active. 52 unit_active?: boolean; 53 } 54 55 Fractional precision is capped at six decimal places. Disabling 56 ``unit_allow_fraction`` forces ``unit_precision_level`` to zero.