Mock Tenant API
Scarica un mock server conforme alla Tenant API e avvialo in locale per testare rapidamente Swagger e Tenant API Sandbox.
Avvio rapido
unzip mock_tenant.zip cd mock_tenant python3 -m venv .venv . .venv/bin/activate pip install fastapi uvicorn uvicorn app:app --host 0.0.0.0 --port 8898
Credenziali
Username: ck_mock_123 Password: cs_mock_123 Customer ID: 123
Base URL
api_base_url: http://localhost:8898/api/v1 store_base_url: http://localhost:8898/store/v1 ext_base_url: http://localhost:8898/ext/v1
Note
I dati fittizi sono in fixtures.json. Puoi modificare credenziali, prodotti, ordini e categorie.
Come usare fixtures.json
Il mock legge fixtures.json ad ogni richiesta: in genere basta salvare il file e riprovare la chiamata (senza riavviare).
{
"auth": { "type": "basic", "username": "ck_mock_123", "password": "cs_mock_123" },
"currency": "EUR",
"currency_minor_unit": 2,
"customers": [ { "id": 123, "...": "..." } ],
"categories": [ { "id": 12, "name": "Scarpe Running", "slug": "scarpe-running", "parent": 0, "count": 3 } ],
"products": [ { "id": 456, "name": "Scarpa Running XZ-200", "price": "129.90", "stock_status": "instock", "...": "..." } ],
"variations": { "456": [ { "id": 101, "price": "129.90", "attributes": [ { "name": "Taglia", "option": "42" } ] } ] },
"orders": [ { "id": 789, "customer_id": 123, "status": "processing", "...": "..." } ]
}
Se cambi auth.username o auth.password, aggiorna anche le credenziali usate da Swagger (Authorize) e dal Tenant API Sandbox.