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