post-management-instances.rst (5317B)
1 .. http:post:: /management/instances 2 3 This request will be used to create a new merchant instance in the backend. 4 It is only available for the implicit ``admin`` instance. 5 6 **Required permission:** ``instances-write`` 7 8 **Request:** 9 10 The request must be a `InstanceConfigurationRequest`. 11 12 **Response:** 13 14 :http:statuscode:`200 Ok`: 15 An instance has been created and a login token is being returned. 16 The response body will be a `InstanceCreatedResponse` 17 :http:statuscode:`202 Accepted`: 18 2FA is required for this operation, usually to validate the 19 email and/or phone numbers registered for the instance. 20 This returns the `ChallengeResponse`. @since **v21** 21 :http:statuscode:`204 No content`: 22 The backend has successfully created the instance. 23 :http:statuscode:`400 Bad Request`: 24 The request body is malformed or a required field is missing. 25 Returned with ``TALER_EC_GENERIC_PARAMETER_MALFORMED`` or ``TALER_EC_GENERIC_PARAMETER_MISSING``. 26 :http:statuscode:`409 Conflict`: 27 This instance already exists, but with other configuration options. 28 Use "PATCH" to update an instance configuration. Alternatively, 29 the currency provided in the configuration does not match the 30 currency supported by this backend. Another possible conflict 31 would be if a deleted but not purged instance is known under this 32 ID to the backend. 33 Returned with ``TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS`` or 34 ``TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED``. 35 :http:statuscode:`413 Request entity too large`: 36 The uploaded body is to long, it exceeds the size limit. 37 Returned with an error code of 38 ``TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT``. 39 :http:statuscode:`500 Internal Server Error`: 40 The server experienced an internal failure. 41 Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED``, 42 ``TALER_EC_GENERIC_DB_START_FAILED`` or 43 ``TALER_EC_GENERIC_DB_COMMIT_FAILED``. 44 45 **Details:** 46 47 .. ts:def:: InstanceConfigurationRequest 48 49 interface InstanceConfigurationRequest { 50 51 // Name of the merchant instance to create (will become $INSTANCE). 52 // Must match the regex ``^[A-Za-z0-9][A-Za-z0-9_.@-]+$``. 53 id: string; 54 55 // Merchant name corresponding to this instance. 56 name: string; 57 58 // Merchant email for customer contact and password reset. 59 email?: string; 60 61 // Merchant phone number for password reset (2-FA) 62 // @since **v21**. 63 phone_number?: string; 64 65 // Merchant public website. 66 website?: string; 67 68 // Merchant logo. 69 logo?: ImageDataUrl; 70 71 // Authentication settings for this instance 72 auth: InstanceAuthConfigurationMessage; 73 74 // The merchant's physical address (to be put into contracts). 75 address: Location; 76 77 // The jurisdiction under which the merchant conducts its business 78 // (to be put into contracts). 79 jurisdiction: Location; 80 81 // Use STEFAN curves to determine default fees? 82 // If false, no fees are allowed by default. 83 // Can always be overridden by the frontend on a per-order basis. 84 use_stefan: boolean; 85 86 // If the frontend does NOT specify a payment deadline, how long should 87 // offers we make be valid by default? 88 // Optional @since **v22** (before the setting was mandatory). 89 // If not provided, the global merchant default will be used. 90 default_pay_delay?: RelativeTime; 91 92 // If the frontend does NOT specify a refund deadline, how long should 93 // refunds be allowed by default? Added on top of the 94 // payment deadline. 95 // @since **v22** 96 default_refund_delay?: RelativeTime; 97 98 // If the frontend does NOT specify an execution date, how long should 99 // we tell the exchange to wait to aggregate transactions before 100 // executing the wire transfer? This delay is added on top of 101 // the refund deadline and afterwards subject to rounding 102 // via the ``default_wire_transfer_rounding_interval``. 103 // Optional @since **v22** (before the setting was mandatory). 104 // If not provided, the global merchant default will be used. 105 default_wire_transfer_delay?: RelativeTime; 106 107 // How far should the wire deadline (if computed with the help of 108 // the ``default_wire_transfer_delay``) be rounded up to compute 109 // the ultimate wire deadline? 110 // @since **v22**, defaults to no rounding if not given. 111 default_wire_transfer_rounding_interval?: RoundingInterval; 112 } 113 114 .. ts:def:: InstanceCreatedResponse 115 116 interface InstanceCreatedResponse { 117 118 // The login token that can be used to access resources 119 // that are in scope for some time. Must be prefixed 120 // with "Bearer " when used in the "Authorization" HTTP header. 121 // Will already begin with the RFC 8959 prefix. 122 // **Since v19** 123 access_token: string; 124 125 // Legacy field for the access token. 126 // @deprecated since **v19**. 127 token: string; 128 129 // Scope of the access token 130 scope: "readonly" | "write" | "all" | "order-simple" | "order-pos" | "order-mgmt" | "order-full"; 131 132 // True if the access token can be refreshed. 133 refreshable: boolean; 134 135 // Time when the access token expires. 136 expiration: Timestamp; 137 138 }