Contents

PATCH [/instances/$INSTANCE]/private/units/$UNIT#

Update attributes of a measurement unit.

Required permission: units-write

Request:

The request must be a UnitPatchRequest.

Response:

204 No content:

The backend updated the unit.

404 Not found:

The unit is unknown to the backend.

Built-in units allow changing unit_allow_fraction, unit_precision_level, and unit_active; other fields are immutable for built-ins.

interface UnitPatchRequest {
  // Updated human-readable long label.
  unit_name_long?: string;

  // Updated human-readable short label.
  unit_name_short?: string;

  // Updated translations for the long label keyed by BCP 47 language tags.
  unit_name_long_i18n?: { [lang_tag: string]: string };

  // Updated translations for the short label keyed by BCP 47 language tags.
  unit_name_short_i18n?: { [lang_tag: string]: string };

  // Override to allow or forbid fractional quantities.
  unit_allow_fraction?: boolean;

  // Override for the fractional precision (0-6). Ignored if fractions are disabled.
  unit_precision_level?: Integer;

  // Toggle whether the unit is active.
  unit_active?: boolean;
}

Fractional precision is capped at six decimal places. Disabling unit_allow_fraction forces unit_precision_level to zero.