taler-docs

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

get-private-units.rst (1773B)


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