Download JSON File
Download a JSON file and validate its structure using JSON Schema or manual assertions.
🔗 Endpoint
GET /api/v1/files/download?format=json&rows=5&type=productsOpen in browser ↗💡 Tips
- ✓Check Content-Type is application/json
- ✓Parse JSON and validate structure
- ✓Use JSON Schema for complex validation
- ✓Test both array and object formats
💻 Code Example
// Playwright: Download and verify JSON
const response = await request.get('/api/v1/files/download?format=json&rows=5&type=products');
expect(response.headers()['content-type']).toContain('application/json');
const data = await response.json();
expect(Array.isArray(data)).toBe(true);
expect(data.length).toBe(5);
// Validate structure
expect(data[0]).toHaveProperty('id');
expect(data[0]).toHaveProperty('name');
expect(data[0]).toHaveProperty('price');
expect(typeof data[0].price).toBe('number');🖥️ curl Command
curl -O "https://api.qa-practice.dev/api/v1/files/download?format=json&rows=5&type=products"