Skip to content

Get cars

[ GET ] cars

Get a list of avaliable car brands and their respective models.

{
    "data": {
        "car_brand_1": [
            "car_model_1",
            "car_model_2",
            "car_model_3"
        ],
        "car_brand_2": [
            "car_model_1",
            "car_model_2",
            "car_model_3"
        ],
        "car_brand_3": [
            "car_model_1",
            "car_model_2",
            "car_model_3"
        ]
    }
}
<?php
    $ch = curl_init();

    curl_setopt_array($ch, [
        CURLOPT_URL => 'YOUR-BASEURL/cars',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_HTTPHEADER => [
            'X-Api-Key: YOUR-API-KEY'
        ],
    ]);

    $response = curl_exec($ch);

    curl_close($ch);
const axios = require('axios');
axios.get('YOUR-BASEURL/cars', {
    headers: {
        'X-Api-Key': 'YOUR-API-KEY'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});