Contents

GET [/instances/$INSTANCE]/private/units#

Returns the list of measurement units available to an instance.

Required permission: units-read

Response:

200 OK:

The backend returned the unit catalog. The body is a UnitListResponse.

Details:

interface UnitListResponse {
  units: MerchantUnit[];
}
interface MerchantUnit {
  // Unique serial for the unit.
  unit_serial: Integer;

  // Short identifier used in product definitions.
  unit: string;

  // Human-readable long label.
  unit_name_long: string;

  // Human-readable short label.
  unit_name_short: string;

  // Optional translations for the long label.
  unit_name_long_i18n?: { [lang_tag: string]: string };

  // Optional translations for the short label.
  unit_name_short_i18n?: { [lang_tag: string]: string };

  // Whether fractional quantities are allowed for this unit.
  unit_allow_fraction: boolean;

  // Maximum fractional precision (0-6) enforced for this unit.
  unit_precision_level: Integer;

  // Whether the unit is currently active.
  unit_active: boolean;

  // True if the unit is provided by the backend and cannot be removed.
  unit_builtin: boolean;
}