taler-docs

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

post-private-categories.rst (1181B)


      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_STORE_FAILED``.
     24 
     25   **Details:**
     26 
     27   .. ts:def:: CategoryCreateRequest
     28 
     29     interface CategoryCreateRequest {
     30 
     31       // Name of the category.
     32       name: string;
     33 
     34       // Translations of the name into various
     35       // languages.
     36       name_i18n?: { [lang_tag: string]: string };
     37 
     38     }
     39 
     40   .. ts:def:: CategoryCreatedResponse
     41 
     42     interface CategoryCreatedResponse {
     43 
     44       // Number of the newly created category.
     45       category_id: Integer;
     46     }