taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

get-private-units.rst (1584B)


      1 .. http:get:: [/instances/$INSTANCE]/private/units
      2 
      3   Returns the list of measurement units available to an instance.
      4 
      5   **Required permission:** ``units-read``
      6 
      7   **Response:**
      8 
      9   :http:statuscode:`200 OK`:
     10     The backend returned the unit catalog. The body is a `UnitListResponse`.
     11   :http:statuscode:`401 Unauthorized`:
     12     The request is unauthorized.
     13   :http:statuscode:`500 Internal Server Error`:
     14     The server experienced an internal failure.
     15     Returned with ``TALER_EC_GENERIC_DB_FETCH_FAILED``.
     16 
     17   **Details:**
     18 
     19   .. ts:def:: UnitListResponse
     20 
     21     interface UnitListResponse {
     22       units: MerchantUnit[];
     23     }
     24 
     25   .. ts:def:: MerchantUnit
     26 
     27     interface MerchantUnit {
     28       // Unique serial for the unit.
     29       unit_serial: Integer;
     30 
     31       // Short identifier used in product definitions.
     32       unit: string;
     33 
     34       // Human-readable long label.
     35       unit_name_long: string;
     36 
     37       // Human-readable short label.
     38       unit_name_short: string;
     39 
     40       // Optional translations for the long label.
     41       unit_name_long_i18n?: { [lang_tag: string]: string };
     42 
     43       // Optional translations for the short label.
     44       unit_name_short_i18n?: { [lang_tag: string]: string };
     45 
     46       // Whether fractional quantities are allowed for this unit.
     47       unit_allow_fraction: boolean;
     48 
     49       // Maximum fractional precision (0-6) enforced for this unit.
     50       unit_precision_level: Integer;
     51 
     52       // Whether the unit is currently active.
     53       unit_active: boolean;
     54 
     55       // True if the unit is provided by the backend and cannot be removed.
     56       unit_builtin: boolean;
     57     }