post-private-tokenfamilies.rst (2503B)
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 :http:statuscode:`404 Not found`: 19 The merchant backend is unaware of the instance. 20 :http:statuscode:`500 Internal Server Error`: 21 The server experienced an internal failure. 22 Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED``. 23 24 **Details:** 25 26 .. ts:def:: TokenFamilyCreateRequest 27 28 interface TokenFamilyCreateRequest { 29 30 // Identifier for the token family consisting of unreserved characters 31 // according to RFC 3986. 32 slug: string; 33 34 // Human-readable name for the token family. 35 name: string; 36 37 // Human-readable description for the token family. 38 description: string; 39 40 // Optional map from IETF BCP 47 language tags to localized descriptions. 41 description_i18n?: { [lang_tag: string]: string }; 42 43 // Additional meta data, such as the ``trusted_domains`` 44 // or ``expected_domains``. Depends on the ``kind``. 45 extra_data?: object; 46 47 // Start time of the token family's validity period. 48 // If not specified, merchant backend will use the current time. 49 valid_after?: Timestamp; 50 51 // End time of the token family's validity period. 52 valid_before: Timestamp; 53 54 // Validity duration of an issued token. 55 duration: RelativeTime; 56 57 // Rounding granularity for the start validity of keys. 58 // The desired time is rounded down to a multiple of this 59 // granularity and then the ``start_offset`` is added to 60 // compute the actual start time of the token keys' validity. 61 // The end is then computed by adding the ``duration``. 62 // Must be 1 minute, 1 hour, 1 day, 1 week, 30 days, 90 days 63 // or 365 days (1 year). 64 validity_granularity: RelativeTime; 65 66 // Offset to subtract from the start time rounded to ``validity_granularity`` 67 // to compute the actual start time for a key. 68 // Default is zero. 69 start_offset: RelativeTime; 70 71 // Kind of the token family. 72 kind: TokenFamilyKind; 73 74 } 75 76 .. ts:def:: TokenFamilyKind 77 78 enum TokenFamilyKind { 79 Discount = "discount", 80 Subscription = "subscription", 81 }