taler-docs

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

post-private-templates.rst (1847B)


      1 .. http:post:: [/instances/$INSTANCE]/private/templates
      2 
      3   This is used to create a template.
      4 
      5   **Required permission:** ``templates-write``
      6 
      7   **Request:**
      8 
      9   The request must be a `TemplateCreateRequest`.
     10 
     11 
     12   **Response:**
     13 
     14   :http:statuscode:`204 No content`:
     15     The creation of the template is successful.
     16   :http:statuscode:`400 Bad Request`:
     17     The request body is malformed.
     18     Returned with ``TALER_EC_GENERIC_PARAMETER_MALFORMED``.
     19   :http:statuscode:`404 Not found`:
     20     The merchant instance or OTP device is unknown.
     21     Returned with ``TALER_EC_MERCHANT_GENERIC_OTP_DEVICE_UNKNOWN``.
     22   :http:statuscode:`409 Conflict`:
     23     A template with this ID already exists.
     24     Returned with ``TALER_EC_MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS``.
     25   :http:statuscode:`413 Request entity too large`:
     26     The uploaded body is to long, it exceeds the size limit.
     27     Returned with an error code of
     28     ``TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT``.
     29   :http:statuscode:`500 Internal Server Error`:
     30     The server experienced an internal failure.
     31     Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED`` or
     32     ``TALER_EC_GENERIC_DB_FETCH_FAILED``.
     33 
     34   **Details:**
     35 
     36 
     37   .. ts:def:: TemplateCreateRequest
     38 
     39     interface TemplateCreateRequest {
     40 
     41       // Template ID to use.
     42       template_id: string;
     43 
     44       // Human-readable description for the template.
     45       template_description: string;
     46 
     47       // OTP device ID.
     48       // This parameter is optional.
     49       otp_id?: string;
     50 
     51       // Fixed contract information for orders created from
     52       // this template.
     53       template_contract: TemplateContractDetails;
     54 
     55       // Key-value pairs matching a subset of the
     56       // fields from ``template_contract`` that are
     57       // user-editable defaults for this template.
     58       // Since protocol **v13**.
     59       editable_defaults?: Object;
     60     }