/api/wallets
GETLists all configured wallets and their locations on the system.
Description
The `/api/wallets` endpoint returns information about all wallets configured in the CloudCoin Console system. Each wallet entry includes its full path, name, and availability status.
Each wallet is identified by its full filesystem path (wallet_path). The wallet_name is extracted from the last directory component of the path.
The `online` field indicates whether the wallet is currently accessible. For example, a wallet on a disconnected USB drive would show `"online": false`.
Parameters
This endpoint does not require any parameters.
Response
Returns a JSON object containing the list of wallets grouped by location.
Response Properties
Example Response (Success)
{
"command": "wallet-list",
"success": true,
"count": 3,
"wallets": [
{
"wallet_path": "E:\\Data\\Wallets\\Default",
"wallet_name": "Default",
"online": true
},
{
"wallet_path": "E:\\Data\\Wallets\\Savings",
"wallet_name": "Savings",
"online": true
},
{
"wallet_path": "F:\\USB\\Backup",
"wallet_name": "Backup",
"online": false
}
]
}
Example Response (No Wallets)
{
"command": "wallet-list",
"success": true,
"message": "No wallets configured",
"count": 0,
"wallets": []
}
Examples
JavaScript (fetch)
const API_HOST = 'http://localhost:8080';
async function listWallets() {
try {
const response = await fetch(`${API_HOST}/api/wallets`);
const result = await response.json();
if (result.success) {
console.log(`Found ${result.count} wallet(s):\n`);
result.wallets.forEach(wallet => {
const status = wallet.online ? '🟢 ONLINE' : '🔴 OFFLINE';
console.log(`${status} ${wallet.wallet_name}`);
console.log(` Path: ${wallet.wallet_path}\n`);
});
} else {
console.error('Failed to list wallets:', result.error || result.message);
}
} catch (error) {
console.error('Error listing wallets:', error);
}
}
listWallets();
cURL
# List all configured wallets
curl -X GET "http://localhost:8080/api/wallets"
Go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
const ApiHost = "http://localhost:8080"
type Wallet struct {
WalletPath string `json:"wallet_path"`
WalletName string `json:"wallet_name"`
Online bool `json:"online"`
}
type WalletListResponse struct {
Command string `json:"command"`
Success bool `json:"success"`
Count int `json:"count"`
Wallets []Wallet `json:"wallets"`
}
func main() {
resp, err := http.Get(fmt.Sprintf("%s/api/wallets", ApiHost))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result WalletListResponse
if err := json.Unmarshal(body, &result); err != nil {
panic(err)
}
if result.Success {
fmt.Printf("Found %d wallet(s):\n\n", result.Count)
for _, wallet := range result.Wallets {
status := "🔴 OFFLINE"
if wallet.Online {
status = "🟢 ONLINE"
}
fmt.Printf("%s %s\n", status, wallet.WalletName)
fmt.Printf(" Path: %s\n\n", wallet.WalletPath)
}
}
}
Related Endpoints
/api/wallets/balance
Check the balance of a specific wallet using wallet_path parameter.
/api/wallets/create
Create a new wallet at a specified path with full directory structure.