The SG Cars Trends API provides powerful filtering capabilities to help you extract specific data subsets. This guide covers all available filtering options and best practices.
# Get all electric vehicle datacurl "https://api.sgcarstrends.com/v1/cars/fuel-types/Electric" \ -H "Authorization: Bearer YOUR_API_KEY"# Get electric vehicle data for specific monthcurl "https://api.sgcarstrends.com/v1/cars/fuel-types/Electric?month=2024-01" \ -H "Authorization: Bearer YOUR_API_KEY"
# Get first page (default)curl "https://api.sgcarstrends.com/v1/cars?page=1&limit=20" \ -H "Authorization: Bearer YOUR_API_KEY"# Get second pagecurl "https://api.sgcarstrends.com/v1/cars?page=2&limit=20" \ -H "Authorization: Bearer YOUR_API_KEY"
Always URL encode parameters with special characters:
Copy
// Correct way to handle spaces and special charactersconst vehicleType = 'Passenger Cars';const encodedType = encodeURIComponent(vehicleType);const url = `https://api.sgcarstrends.com/v1/cars/vehicle-types/${encodedType}`;