Years
GET /api/years/powersports
Section titled “GET /api/years/powersports”Returns available model years for street motorcycles. The demo dataset covers years 2015–2020. To access the full range from 1930 to today, subscribe and include a valid JWT.
The type parameter is required and must be set to street_motorcycle.
Sample Request
Section titled “Sample Request”curl "https://carapi.app/api/years/powersports?type=street_motorcycle" \ -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE"const params = new URLSearchParams({ type: 'street_motorcycle' });
const response = await fetch(`https://carapi.app/api/years/powersports?${params}`, { headers: { 'Authorization': `Bearer ${jwt}` }});
const data = await response.json();console.log('Years:', data);import requests
headers = { 'Authorization': f'Bearer {jwt}'}
params = { 'type': 'street_motorcycle'}
response = requests.get( 'https://carapi.app/api/years/powersports', headers=headers, params=params)
data = response.json()print('Years:', data)use GuzzleHttp\Client;
$client = new Client();
$response = $client->get('https://carapi.app/api/years/powersports', [ 'headers' => [ 'Authorization' => 'Bearer YOUR_JWT_TOKEN_HERE', ], 'query' => [ 'type' => 'street_motorcycle', ],]);
$data = json_decode($response->getBody(), true);print_r($data);$url = 'https://carapi.app/api/years/powersports?' . http_build_query([ 'type' => 'street_motorcycle',]);
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer YOUR_JWT_TOKEN_HERE',]);
$response = curl_exec($ch);curl_close($ch);
$data = json_decode($response, true);print_r($data);Sample Response
Section titled “Sample Response”[ 2020, 2019, 2018, 2017, 2016, 2015]Filtering
Section titled “Filtering”curl "https://carapi.app/api/years/powersports?type=street_motorcycle&make=Harley+Davidson&json=[{\"field\":\"make\",\"op\":\"in\",\"val\":[\"Kawasaki\",\"Harley Davidson\"]}]" \ -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE"const filter = JSON.stringify([ { field: 'make', op: 'in', val: ['Kawasaki', 'Harley Davidson'] }]);
const params = new URLSearchParams({ type: 'street_motorcycle', make: 'Harley Davidson', json: filter});
const response = await fetch( `https://carapi.app/api/years/powersports?${params}`, { headers: { 'Authorization': `Bearer ${jwt}` } });
const data = await response.json();console.log('Years:', data);import requestsimport json
headers = {'Authorization': f'Bearer {jwt}'}
params = { 'type': 'street_motorcycle', 'make': 'Harley Davidson', 'json': json.dumps([ {'field': 'make', 'op': 'in', 'val': ['Kawasaki', 'Harley Davidson']} ])}
response = requests.get( 'https://carapi.app/api/years/powersports', headers=headers, params=params)
data = response.json()print('Years:', data)use GuzzleHttp\Client;
$client = new Client();
$response = $client->get('https://carapi.app/api/years/powersports', [ 'headers' => [ 'Authorization' => 'Bearer YOUR_JWT_TOKEN_HERE', ], 'query' => [ 'type' => 'street_motorcycle', 'make' => 'Harley Davidson', 'json' => json_encode([ ['field' => 'make', 'op' => 'in', 'val' => ['Kawasaki', 'Harley Davidson']], ]), ],]);
$data = json_decode($response->getBody(), true);print_r($data);$filter = json_encode([ ['field' => 'make', 'op' => 'in', 'val' => ['Kawasaki', 'Harley Davidson']],]);
$url = 'https://carapi.app/api/years/powersports?' . http_build_query([ 'type' => 'street_motorcycle', 'make' => 'Harley Davidson', 'json' => $filter,]);
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer YOUR_JWT_TOKEN_HERE',]);
$response = curl_exec($ch);curl_close($ch);
$data = json_decode($response, true);print_r($data);