import-db-from-file.rst (1071B)
1 .. ts:op:: importDbFromFile 2 3 Import the database from a JSON or SQLite file. **Caution:** this 4 overrides existing data. 5 6 **Request:** 7 8 The request arguments must be an `ImportDbFromFileRequest` object. 9 10 **Response:** 11 12 On success, the result is an empty object. 13 14 **Side effects:** 15 16 Replaces the entire contents of the wallet database with the dump 17 read from the given file. 18 19 **Expected errors:** 20 21 The caller can handle the following errors inline: 22 ``WALLET_DB_BACKEND_UNSUPPORTED``, ``WALLET_CORE_API_BAD_REQUEST``, 23 ``WALLET_CORE_REQUEST_CANCELLED``. 24 25 **Details:** 26 27 The ``path`` must end in ``.json`` or ``.sqlite3``; other files 28 are rejected with ``WALLET_CORE_API_BAD_REQUEST``, as is a file 29 that cannot be read. The ``progressToken`` behaves as for 30 :ts:op:`importDb`. 31 32 .. ts:def:: ImportDbFromFileRequest 33 34 interface ImportDbFromFileRequest { 35 // Full path to a .json or .sqlite3 backup. 36 path: string; 37 38 // Correlates progress notifications and allows cancellation. 39 progressToken?: string; 40 }