# Car Queries

### Get Car Details

Returns the details of the car based on the specified Car ID or Vehicle Registration Mark (VRM), otherwise referred to as Car Registration Number.

The returned details include whether MBMC have the necessary measurements available to determine if a buggy or other item will fit in the boot. `boot_measurement_available` returns a `Yes` or `No` response. A `Yes` confirms that this car will be able to return helpful results from the comparison APIs

**Note**, the `carid` must be identified using the [Car ID Lookup](#carid-lookups) searches. Alternatively, you could use the `vrm` parameter to perform this lookup.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getcar&vrm=[VRM]`\
\
**OR**\
\
&#x20;`https://api.mybuggymycar.com/api/search.php?s=getcar&carid=[CARID]`

#### URL Parameters

| Parameter | Type    | Required?        | Description                                                                                                                                                              |
| --------- | ------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| carid     | Integer | Yes (or `vrm`)   | A valid `carid`.  The `carid` corresponds to a car id that can be identified using the [Car ID Lookup](#carid-lookups) searches.  Alternatively, use the `vrm` parameter |
| vrm       | String  | Yes (or `carid`) | An alternative to the `carid` parameter.  A valid UK registered car Vehicle Registration Mark (Car Registration Number).                                                 |

{% hint style="info" %}
**Counts against quota**: Yes
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
  --url 'https://api.mybuggymycar.com/api/search.php?s=getcar&vrm=[VRM]' \
  --header 'authorization: Basic YOUR_BASE64_KEY'

# alternatively replace vrm=[VRM] for carid=[CARID] to search by Car ID number (see [Car ID Lookup](#carid-lookups) details)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getcar&vrm=[VRM]');
// alternatively replace vrm=[VRM] for carid=[CARID] to search by Car ID number (see [Car ID Lookup](#carid-lookups) details)

$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}

conn.request("GET", "/api/search.php?s=getcar&vrm=[VRM]]", payload, headers)
# alternatively replace vrm=[VRM] for carid=[CARID] to search by Car ID number (see [Car ID Lookup](#carid-lookups) details)

res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getcar&vrm=[VRM]");
xhr.setRequestHeader("authorization", "Basic YOUR_BASE64_KEY");

xhr.send(data);

// alternatively replace vrm=[VRM] for carid=[CARID] to search by Car ID number (see [Car ID Lookup](#carid-lookups) details)
```

{% endtab %}
{% endtabs %}

> `[VRM]` can be replaced with a valid `[CARID]` that can be obtained by using the [Car ID Lookup](#carid-lookups) queries. Note, if both are supplied, vrm will be taken in preference. `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTON_KEY",
        "name": "YOUR NAME"
        "subscription_active": "1",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "15-01-2021",         
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "209"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "car_searched": {
            "carID": "xxxxxxx",
            "vrm": "",
            "manufacturer": "PEUGEOT",
            "model": "508",
            "body_type": "Hatchback",
            "detailed_model_name": "1.6 Hybrid Allure Premium 5dr e-EAT8",
            "years": "2020 - ",
            "boot_measurement_available": "Yes",
            "lower_boot_measurements_available": "No",
            "third_row_measurements_available": "No",
            "measurements_requested": "boot"
        }
    },
    "results": {
        "error_message": "The search was successful"
    }
}
```

### CarID Lookups

In the event that a Car Registration number isn't known or is not being returned as expected (perhaps because of a new car registration not having propagated across all systems yet), the 5 CarID Lookup queries can be used to identify a carID

The searches are 'cumulative' and all 5 components are required to return the correct ID for the car to be searched with.

A possible UI workflow could be that the data returned from each of these queries be surfaced via a set of drop down lists (or similar) with the value from each then being used to complete the parameters of the subsequent searches.

### CarID Lookup 1 - getMakes

Returns a list of all Car Manufacturers. This query should be **1** of **5** to identify a valid `carid`

There are no mandatory or optional parameters for this query.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getmakes`

{% hint style="info" %}
**Counts against quota**: No
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=getmakes' \
--header 'Authorization: Basic YOUR_BASE64_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getmakes');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=getmakes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getmakes");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTON_KEY",
        "name": "YOUR NAME",
        "subscription_active": "1",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "15-01-2021",         
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "223"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Car Manufacturers"
    },
    "results": [
        {
            "manufacturer": "ABARTH"
        },
        {
            "manufacturer": "AIXAM"
        },
        {
            "manufacturer": "ALFA ROMEO"
        },
        {
            "manufacturer": "ALPINE"
        },
        {
            "manufacturer": "ASTON MARTIN"
        },
        {
            "manufacturer": "AUDI"
        }
    ]
}
```

###

### CarID Lookup 2 - getModels

Returns a list of all Car Manufacturers. This query should be **2** of **5** to identify a valid `carid`

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getmodels&make=<MAKE>`

#### URL Parameters

| Parameter | Type   | Required? | Default | Description                                                                                     |
| --------- | ------ | --------- | ------- | ----------------------------------------------------------------------------------------------- |
| make      | String | Yes       | N/A     | The name of a car manufacturer as returned by the [`carMakes`](#carid-lookup-1-getmakes) query. |

{% hint style="info" %}
**Counts against quota**: No
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=getmodels&make=<MAKE>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getmodels&make=<MAKE>');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=getmodels&make=<MAKE>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getmodels&make=<MAKE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> `<MAKE>` should be replaced with the name of a Car Manufacturer returned from the [getMakes](#carid-lookup-1-getmakes) query. `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTON_KEY",
        "name": "YOUR NAME",
        "subscription_active": "1",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "15-01-2021",         
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "223"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Car Models",
        "manufacturer": "ABARTH"
    },
    "results": [
        {
            "model_name": "124 SPIDER ROADSTER"
        },
        {
            "model_name": "124 SPIDER ROADSTER SPECIAL EDITION"
        },
        {
            "model_name": "500 HATCHBACK"
        },
        {
            "model_name": "500C CONVERTIBLE"
        }
    ]
}
```

###

### CarID Lookup 3 - getFuelType

Returns a list of all Fuel Types that the specified car model is available with. This query should be **3** of **5** to identify a valid `carid`

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getfueltype&make=<MAKE>&model=<MODEL>`

#### URL Parameters

| Parameter | Type   | Required? | Default | Description                                                                                     |
| --------- | ------ | --------- | ------- | ----------------------------------------------------------------------------------------------- |
| make      | String | Yes       | N/A     | The name of a car manufacturer as returned by the [`getMakes`](#carid-lookup-1-getmakes) query. |
| model     | String | Yes       | N/A     | The name of a car model as returned by the [`getModels`](#carid-lookup-2-getmodels) query       |

{% hint style="info" %}
**Counts against quota**: No
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=getfueltype&make=<MAKE>&model=<MODEL>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getfueltype&make=<MAKE>&model=<MODEL>');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=getfueltype&make=<MAKE>&model=<MODEL>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getfueltype&make=<MAKE>&model=<MODEL>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> `<MAKE>` should be replaced with the name of a Car Manufacturer returned from the [getMakes](#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced witht he name of a Car Model returned from the [getModels](#carid-lookup-2-getmodels) query `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTION_KEY",
        "name": "YOUR NAME",
        "subscription_active": "active",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "22-02-2021",
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "52"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Car Model Fuel Types",
        "manufacturer": "MERCEDES",
        "model": "E-CLASS ESTATE"
    },
    "results": [
        {
            "fuel_type": "Diesel"
        },
        {
            "fuel_type": "Hybrid Diesel"
        },
        {
            "fuel_type": "Mild Hybrid Electric Diesel"
        },
        {
            "fuel_type": "Mild Hybrid Electric Petrol"
        },
        {
            "fuel_type": "Petrol"
        },
        {
            "fuel_type": "Plug In Hybrid Diesel"
        }
    ]
}
```

### CarID Lookup 4 - getYears

Returns a list of all Years that the specified car model was available between. This query should be **4** of **5** to identify a valid `carid`

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getmodels&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>`

#### URL Parameters

| Parameter | Type   | Required? | Default | Description                                                                                     |
| --------- | ------ | --------- | ------- | ----------------------------------------------------------------------------------------------- |
| make      | String | Yes       | N/A     | The name of a car manufacturer as returned by the [`getMakes`](#carid-lookup-1-getmakes) query. |
| model     | String | Yes       | N/A     | The name of a car model as returned by the [`getModels`](#carid-lookup-2-getmodels) query       |
| fuel      | String | Yes       | N/A     | The name of a fuel type returned by the [`getFuelType`](#carid-lookup-3-getfueltype) query      |

{% hint style="info" %}
**Counts against quota**: No
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=getyears&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getyears&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=getyears&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getyears&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> `<MAKE>` should be replaced with the name of a Car Manufacturer returned from the [getMakes](#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced with the name of a Car Model returned from the [getModels](#carid-lookup-2-getmodels) query. `<FUELTYPE>` should be replace with one of the Fuel Types returned from the [getFuelType](#carid-lookup-3-getfueltype) query. `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTION_KEY",
        "name": "YOUR NAME",
        "subscription_active": "active",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "22-02-2021",
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "52"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Car Model Years",
        "manufacturer": "Mercedes",
        "model": "E-Class Saloon",
        "fuel_type": "diesel"
    },
    "results": [
        {
            "year_group_id": "xxxxxxx",
            "car_model_years_from": "2009",
            "car_model_years_to": "2012",
            "boot_capacity": "540.00",
            "fuel_type": "Diesel"
        },
        {
            "year_group_id": "xxxxxxx",
            "car_model_years_from": "2011",
            "car_model_years_to": "2013",
            "boot_capacity": "540.00",
            "fuel_type": "Diesel"
        },
        {
            "year_group_id": "xxxxxxx",
            "car_model_years_from": "2012",
            "car_model_years_to": "2013",
            "boot_capacity": "540.00",
            "fuel_type": "Diesel"
        },
        {
            "year_group_id": "xxxxxxx",
            "car_model_years_from": "2013",
            "car_model_years_to": "2016",
            "boot_capacity": "490.00",
            "fuel_type": "Diesel"
        }
    ]
}
```

###

### CarID Lookup 5 - getDerivatives

Returns a list of all Car Derivatives that match the Make, Model, Fuel Type and Year Group ID specified.

This query should be **5** of **5** with any of the `carid` values that are returned able to be used in the other comparison queries in lieu or a `vrm` value

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getderivatives&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>&year=<YEARID>`

#### URL Parameters

| Parameter | Type    | Required? | Default | Description                                                                                     |
| --------- | ------- | --------- | ------- | ----------------------------------------------------------------------------------------------- |
| make      | String  | Yes       | N/A     | The name of a car manufacturer as returned by the [`getMakes`](#carid-lookup-1-getmakes) query. |
| model     | String  | Yes       | N/A     | The name of a car model as returned by the [`getModels`](#carid-lookup-2-getmodels) query.      |
| fuel      | String  | Yes       | N/A     | The name of a fuel type returned by the [`getFuelType`](#carid-lookup-3-getfueltype) query.     |
| year      | Integer | Yes       | N/A     | A year id returned from the [`getYears`](#carid-lookup-4-getyears) query.                       |

{% hint style="info" %}
**Counts against quota**: Yes
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=getderivatives&make=<MAKE>&model=<MODEL>&year=<YEARID>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();

$request->setUrl('https://api.mybuggymycar.com/api/search.php?s=getderivatives&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>&year=<YEARID>');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=getderivatives&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>&year=<YEARID>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mybuggymycar.com/api/search.php?s=getderivatives&make=<MAKE>&model=<MODEL>&fuel=<FUELTYPE>&year=<YEARID>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> `<MAKE>` should be replaced with the name of a Car Manufacturer returned from the [getMakes](#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced witht he name of a Car Model returned from the [getModels](#carid-lookup-2-getmodels) query `<FUELTYPE>` should be replace with one of the Fuel Types returned from the [getFuelType](#carid-lookup-3-getfueltype) query. `<YEARID>` should be replaced with `year_group_id` returned from the [getYears](#carid-lookup-4-getyears) query `YOUR_BASE64_KEY` needs to be replaced with your API key.
>
> The above command returns JSON structured like this:

```javascript
{
    "account": {
        "subscriber": "YOUR_SUBSCRIPTON_KEY",
        "name": "YOUR NAME",
        "subscription_active": "1",
        "subscription_plan_name": "Executive",
        "subscription_renewal_date": "15-01-2021",         
        "no_api_calls_allowed": 2000,
        "no_api_calls_used": "225"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Car Model Derivatives",
        "manufacturer": "ABARTH",
        "model": "500 HATCHBACK",
        "year": "xxxxxxx"
    },
    "results": [
        {
            "carid": "xxxxxxx",
            "car_derivative_name": "1.4 16V T-Jet 140 3dr Auto",
            "measurements_available": "Yes"
        },
        {
            "carid": "xxxxxxx",
            "car_derivative_name": "1.4 16V T-Jet 3dr",
            "measurements_available": "Yes"
        }
    ]
}
```
