post-private-tokenfamilies.rst (3128B)
1 .. http:post:: [/instances/$INSTANCE]/private/tokenfamilies 2 3 This is used to create a token family. 4 5 **Required permission:** ``tokenfamilies-write`` 6 7 **Request:** 8 9 The request must be a `TokenFamilyCreateRequest`. 10 11 **Response:** 12 13 :http:statuscode:`204 No content`: 14 The token family was created successfully. 15 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 backend is unaware of the instance. 21 :http:statuscode:`409 Conflict`: 22 A token family with this slug already exists. 23 Returned with ``TALER_EC_MERCHANT_POST_TOKEN_FAMILY_CONFLICT``. 24 :http:statuscode:`413 Request entity too large`: 25 The uploaded body is to long, it exceeds the size limit. 26 Returned with an error code of 27 ``TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT``. 28 :http:statuscode:`500 Internal Server Error`: 29 The server experienced an internal failure. 30 Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED``, 31 ``TALER_EC_GENERIC_DB_START_FAILED``, 32 ``TALER_EC_GENERIC_DB_FETCH_FAILED``, 33 ``TALER_EC_GENERIC_DB_SOFT_FAILURE``, 34 ``TALER_EC_GENERIC_DB_COMMIT_FAILED`` or 35 ``TALER_EC_GENERIC_DB_INVARIANT_FAILURE``. 36 37 **Details:** 38 39 .. ts:def:: TokenFamilyCreateRequest 40 41 interface TokenFamilyCreateRequest { 42 43 // Identifier for the token family consisting of unreserved characters 44 // according to RFC 3986. 45 slug: string; 46 47 // Human-readable name for the token family. 48 name: string; 49 50 // Human-readable description for the token family. 51 description: string; 52 53 // Optional map from IETF BCP 47 language tags to localized descriptions. 54 description_i18n?: { [lang_tag: string]: string }; 55 56 // Additional meta data, such as the ``trusted_domains`` 57 // or ``expected_domains``. Depends on the ``kind``. 58 extra_data?: object; 59 60 // Start time of the token family's validity period. 61 // If not specified, merchant backend will use the current time. 62 valid_after?: Timestamp; 63 64 // End time of the token family's validity period. 65 valid_before: Timestamp; 66 67 // Validity duration of an issued token. 68 duration: RelativeTime; 69 70 // Rounding granularity for the start validity of keys. 71 // The desired time is rounded down to a multiple of this 72 // granularity and then the ``start_offset`` is added to 73 // compute the actual start time of the token keys' validity. 74 // The end is then computed by adding the ``duration``. 75 // Must be 1 minute, 1 hour, 1 day, 1 week, 30 days, 90 days 76 // or 365 days (1 year). 77 validity_granularity: RelativeTime; 78 79 // Offset to subtract from the start time rounded to ``validity_granularity`` 80 // to compute the actual start time for a key. 81 // Default is zero. 82 start_offset: RelativeTime; 83 84 // Kind of the token family. 85 kind: TokenFamilyKind; 86 87 } 88 89 .. ts:def:: TokenFamilyKind 90 91 enum TokenFamilyKind { 92 Discount = "discount", 93 Subscription = "subscription", 94 }