taler-docs

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

post-private-categories.rst (1310B)


      1 .. http:post:: [/instances/$INSTANCE]/private/categories
      2 
      3   This is used to create a new category for the inventory.
      4   Since API version **v16**.
      5 
      6   **Required permission:** ``categories-write``
      7 
      8   **Request:**
      9 
     10     The request is a `CategoryCreateRequest`.
     11 
     12   **Response:**
     13 
     14   :http:statuscode:`200 Ok`:
     15     The response is a `CategoryCreatedResponse`.
     16   :http:statuscode:`400 Bad Request`:
     17     The request body is malformed.
     18   :http:statuscode:`409 Conflict`:
     19     A category with this name already exists.
     20     Returned with ``TALER_EC_MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS``.
     21   :http:statuscode:`500 Internal Server Error`:
     22     The server experienced an internal failure.
     23     Returned with ``TALER_EC_GENERIC_DB_START_FAILED``,
     24     ``TALER_EC_GENERIC_DB_FETCH_FAILED``,
     25     ``TALER_EC_GENERIC_DB_SOFT_FAILURE`` or
     26     ``TALER_EC_GENERIC_DB_COMMIT_FAILED``.
     27 
     28   **Details:**
     29 
     30   .. ts:def:: CategoryCreateRequest
     31 
     32     interface CategoryCreateRequest {
     33 
     34       // Name of the category.
     35       name: string;
     36 
     37       // Translations of the name into various
     38       // languages.
     39       name_i18n?: { [lang_tag: string]: string };
     40 
     41     }
     42 
     43   .. ts:def:: CategoryCreatedResponse
     44 
     45     interface CategoryCreatedResponse {
     46 
     47       // Number of the newly created category.
     48       category_id: Integer;
     49     }