# My Buggy My Car API Reference

Welcome to the My Buggy My Car API reference.  This site provides details of the queries and responses available from the My Buggy My Car API.

### Introduction

My Buggy My Car is the only website to provide tools to find if a buggy will fit in a car. But now we're providing our data for all to use - and you're not restricted to buggies!

If you want to provide assurances to your customers that your products or their items will fit in their car boot, this API can help to provide that.

We offer a 30-day free trial to test the API and build your solution. Some of the returned results are limited to a small number of the datasets until your paid subscription starts, however, the functionality remains the same regardless of your trial or full subscription so you can build your code with confidence. To start your free trial, please [sign up here](https://api.mybuggymycar.com/portal/get_admin_page.php?p=create_account).

### Some important notes

**The data available is for cars and buggies available for sale in the United Kingdom**. It's possible that the same cars and buggies are available globally, however, we're not yet in a position to confirm this, and therefore if you're looking to use these tools outside of the UK, we'd suggest you add some clarification to your implementation for your customers.

It's also important to highlight that **this API is an advisory service**. Car Boots are not perfect square boxes; rear seats reduce the space between the bottom and the top of the boot, the sides frequently have to accommodate space for the rear wheels and there are pockets and compartments that manufacturers provide to maximise the storage and flexibility of a boot. As such, there is an element of subjectivity to our data captures as we measure what we believe to be the narrowest, but most usable space within a boot.

### Using your quota

Each subscription comes with an allowable number of queries you can perform each month. We like to offer the best value for the number of queries and so if you submit an invalid/incomplete query and an error is returned, this will not count against your quota. Additionally, if we haven't measured a specified car boot, this also won't count against your quota. There are some queries that are also provided without charge and we've indicated in the documentation where a charge applies against your quota


# Authentication

This page describes authenticating your subscription in order to use the API

The My Buggy My Car API uses Basic authentication and utilises your Subscription ID as a username equivalent and API Key as a password equivalent. The client should send an HTTP request with the `Authorization` header that contains the word Basic followed by a space and a base64-encoded string subscription\_id:api\_key. For example, to authorise as `demo : p@55w0rd` the client would send

`Authorization: Basic ZGVtbzpwQDU1d29yZA==`

If you're not familiar with generating a base64-encoded string, we can recommend the use of website <https://www.base64encode.org>.&#x20;

{% hint style="info" %}
Note If you are generating your encoded string with linux, please ensure to include the -n flag to remove any surplus/hidden characters e.g. `echo -n 'demo:p@55w0rd' | base64`
{% endhint %}

The My Buggy My Car API requires the `Authorization` header is sent with all API requests to the server or a 403 error will be returned.

&#x20;You must replace `ZGVtbzpwQDU1d29yZA==` with your personal Base64 encoded Subscription ID and API Key.

> To authorise, you're welcome to use this sample code:

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

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

$request->setUrl('https://api.mybuggymycar.com/API_ENDPOINT_HERE');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Basic YOUR_BASE64_KEY'
));
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")

headers = { 'authorization': "Basic YOUR_BASE64_KEY" }

conn.request("GET", "API_ENDPOINT_HERE", headers=headers) you cpass the correct header 
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl  --location --request GET 'API_ENDPOINT_HERE'
  --header 'authorization: Basic YOUR_BASE64_KEY'
```

{% 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_ENDPOINT_HERE");
xhr.setRequestHeader("authorization", "Basic YOUR_BASE64_KEY");

xhr.send(data);
```

{% endtab %}
{% endtabs %}

> Make sure to replace `API_ENDPOINT_HERE` with the appropriate query and `YOUR_BASE64_KEY` with your API key.


# API Response Structure

This page describes the response structure of successful API queries

Unless explicitly mentioned, JSON will be returned in all responses.

Each successful query response will be returned in a standard structure. The following table provides an explanation of each key/value that is returned

> Standard JSON response:

```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"
        },
        "buggy_searched": {
            "brand_id": "35"
            "brand_name": "Phil and Teds",
            "buggy_model_id": "557",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Capri",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",            
            "buggy_dimensions": "Standard measurements",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault300/brands/phil-and-teds/557-phil-and-teds-mod-cap...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/557-phil-and-teds-mod-cap..."
            }   
        }
    },
    "results": [
        {
            "willItFit": "Yes",
            "fitLayingDownLR": "Yes",
            "fitLayingDownFB": "Yes",
            "fitLayingDownOnSide": "Yes",
            "fitLayingDownOnEnd": "Yes",
            "error_message": "The search was successful"
        }
    ]
}
```

###

### account

This part of the returned JSON provides details about your account subscription. It is intended to provide confidence that your credentials and subscription plan are correct, however, it also provides a running total of the number of queries you've made this month.

{% hint style="warning" %}
**The details return in the account section should be safe-guarded and not published on your system for consumption**
{% endhint %}

> Standard JSON response:

```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"
    }
}
```

| Key                         | Response Description                                                                                                                                                                                                                                                          |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| subscriber                  | Your Subscription Key used to process this query.  You can rotate your Subscription Key (and API Key) from the customer portal                                                                                                                                                |
| name                        | Your name as defined in your profile in the Customer Portal.                                                                                                                                                                                                                  |
| subscription\_active        | Will always return as 1 (for Yes) if a query is successful.                                                                                                                                                                                                                   |
| subscription\_plan\_name    | The name of the plan you are subscribed to.  Note, if you have multiple subscriptions, the plan name is the one associated with the Subscription Key used.                                                                                                                    |
| subscription\_renewal\_date | The date your plan will renew and next payment will be taken.  If a cancellation has been requested this value will be replaced with `subscription_expiry_date`                                                                                                               |
| no\_api\_calls\_allowed     | This shows the total number of API calls allowed for this month as defined by the subscription plan.  In the event we increase the number allowed, this will be reflected here                                                                                                |
| np\_api\_calls\_used        | The number of API calls made this month that have counted against your subscription.  **Note - this is the number of calls made prior to executing this query.**  The number of queries performed that haven't applied against your quota can be seen in the Customer Portal. |

### response

This section provides a 'technical' response code intended to provide the developer with some basic 'debug' information to explain the reason for the code. The `message` value will contain any comments returns from the query.

> Standard JSON response:

```javascript
{

    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    }
}
```

{% hint style="warning" %}
Note - The code values that are returned mirror HTTP response codes.  HTTP response codes are also set but we would recommend parsing this `response` for errors rather than relying on the HTTP response code.

**We don't recommend these details are published on your system**
{% endhint %}

| code | code\_description | message / details                                                                                                                                                                           |
| ---- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | Ok                | The query was successful irrespective of whether the results give a positive response                                                                                                       |
| 400  | Bad Request       | Likely returned if a parameter is missing from a query.  The `message` value will detail the parameter that is missing.  Check this documentation for the correct parameter values.         |
| 401  | Unauthorized      | It's likely your Subscription Key or API Key are not valid                                                                                                                                  |
| 403  | Forbidden         | Your subscription doesn't allow for the call made or you've implemented Whitelist restrictions in your control panel - please check these settings allow your system to connect             |
| 404  | Not Found         | You've requested a page or search query that doesn't exist. **PLEASE NOTE** - we also return a 404 in the event that no results have been found                                             |
| 422  | Unprocessable     | The structure of the query is correct, but one of the parameters contains an invalid value.  Where possible, the system will use default values to mitigate but this isn't always possible. |
| 503  | Maintenance       | We're currently undertaking some maintenance.  We currently have a nightly maintenance routine that runs for circa 1 hour.                                                                  |

### search

This section of the JSON response returns details about the query that has been requested. Depending on the type of query, the array contained within will change. In general, if a car-based search has been performed then the `car_searched` array will be returned. If a buggy-based query is performed then the `buggy_searched` array will be returned. In some cases, both are returned and in some cases only a basic response is provided (for example where the query doesn't require any parameters to be provided)

> Standard JSON response:

```javascript
{
    "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"
        },
        "buggy_searched": {
            "brand_id": "35"
            "brand_name": "Phil and Teds",
            "buggy_model_id": "557",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Capri",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",            
            "buggy_dimensions": "Standard measurements",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault300/brands/phil-and-teds/557-phil-and-teds-mod-cap...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/557-phil-and-teds-mod-cap..."
            }
        }
    }
}
```

| Key                                                                                         | Options                                                                                | Default                   | Response Description                                                                                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| carID or VRM                                                                                | N/A                                                                                    | N/A                       | Returns the parameter you provided as part of your search.  **Note - if you've used a carID this should not be published or be made available on your website either rendered or as part of the page source code.**                                                                                                                        |
| <p>manufacturer<br>model<br>body\_type<br>detailed\_model\_name<br>years</p>                | N/A                                                                                    | N/A                       | Indicates the car associated with the `carID` or `vrm` parameter.  Intended to provide some comfort to your users that the correct car has been found/used in the search                                                                                                                                                                   |
| boot\_measurement\_available                                                                | <p>Yes<br>No</p>                                                                       | N/A                       | <p>"Yes" indicates that we have at least the core boot measurements available with which to perform a search. <br> "No" indicates that we have not captured the measurements of this car model yet and therefore searches that require this car will fail.</p>                                                                             |
| lower\_boot\_measurments\_available                                                         | <p>Yes<br>No</p>                                                                       | N/A                       | <p>"Yes" indicates that the car model has a removable floor or lower boot area that is useful for meaningful storage, and the API can use the measurements. <br> "No" either indicates that there is no lower boot area for this model or the API doesn't have the measurements captured yet.</p>                                          |
| 3rd\_row\_measurements\_available                                                           | <p>Yes<br>No</p>                                                                       | N/A                       | <p>"Yes" indicates that the car has a 3rd row of seats (likely a 7-seater vehicle) and that the API can use the measurements for the space behind the 3rd row. <br> "No" either indicates that the car does not have a 3rd row of seats or that the API doesn't have the measurements captured yet.</p>                                    |
| measurements\_requested                                                                     | <p>boot<br>lower<br>ceiling<br>max\_height<br>seats\_flat<br>3rdboot<br>3rdceiling</p> | boot                      | Details the measurements requested to be used in the search parameters (see [Car Queries](/car-queries) for more details).                                                                                                                                                                                                                 |
| <p>brand\_name<br>buggy\_model\_id<br>buggy\_model\_name</p><p>buggy\_variant\_name<br></p> | N/A                                                                                    | N/A                       | Indicates the buggy details searched                                                                                                                                                                                                                                                                                                       |
| buggy\_folded\_dimensions                                                                   | N/A                                                                                    | N/A                       | The folded measurements of the buggy shown in cm.  Length, width, height.                                                                                                                                                                                                                                                                  |
| buggy\_dimensions                                                                           | <p>0 - Standard Measurements<br>1 - Smallest Measurements</p>                          | 0 - Standard Measurements | Details the measurements requested to be used in the search parameters (see [Buggy Queries](/buggy-queries)                                                                                                                                                                                                                                |
| images: buggy\_image\_url                                                                   | N/A                                                                                    | N/A                       | Will only be returned in 'buggy\_searched' for [Will A Buggy Fit](/buggy-queries#will-a-buggy-fit-in-a-car-boot) and [Will A Buggy Fit In A Space](/buggy-queries#will-a-buggy-fit-in-to-a-space) searches.  A url to a 300x300 image of the buggy searched for.  The url incorporates a signature that changes on each search             |
| images: buggy\_thumbnail                                                                    | N/A                                                                                    | N/A                       | Will only be returned in 'buggy\_searched' for [Will A Buggy Fit](/buggy-queries#will-a-buggy-fit-in-a-car-boot) and [Will A Buggy Fit In A Space](/buggy-queries#will-a-buggy-fit-in-to-a-space) searches.  A url to a thumbnail (150x150) image of the buggy searched for.  The url incorporates a signature that changes on each search |

### results

This section of the JSON response contains the results returned by each query.  Each query returns a different results array - please refer to the documentation for each query.

> Standard JSON response:

```javascript
{
    "results": [
        {
            "willItFit": "Yes",
            "fitLayingDownLR": "Yes",
            "fitLayingDownFB": "Yes",
            "fitLayingDownOnSide": "Yes",
            "fitLayingDownOnEnd": "Yes",
            "error_message": "The search was successful"
        }
    ]
}
```

| Key            | Options | Default | Response Description                                                                                                       |
| -------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| error\_message | N/A     | N/A     | Provides a 'customer friendly' response that might be of use to your customers if a search has not completed successfully. |


# Buggy Queries

This page deals the Buggy queries available from the API

### Get All Buggy Brands

This call returns a list of Buggy Brands.

The returned results include a buggy brand `id`. These returned values can be used in other API calls where `[BRANDID]` is required.

There are no mandatory or optional parameters for this query.

#### HTTP Request

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

{% 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=getbuggybrands' \
--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=getbuggybrands');
$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();
}ph
```

{% 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=getbuggybrands", 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=getbuggybrands");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> Make sure to replace `YOUR_BASE64_KEY` 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": "226"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Buggy Brands"
    },
    "results": [
        {
            "id": "xxxxxxx",
            "brand_name": "ABC Design"
        },
        {
            "id": "xxxxxxx",
            "brand_name": "Ark"
        },
        {
            "id": "xxxxxxx",
            "brand_name": "Asalvo"
        },
        {
            "id": "xxxxxxx",
            "brand_name": "BabaBing"
        },
        {
            "id": "xxxxxxx",
            "brand_name": "Baby Elegance"
        },
        {
            "id": "xxxxxxx",
            "brand_name": "Baby Jogger"
        }
    ]
}
```

### Get Buggy Models List

Get the Buggy Models for a given Buggy Brand ID. This provides a limited result array and is intended to support searching/identification of a buggy e.g. perhaps for use in a Drop Down List. For more detailed buggy responses, use [`Get Buggy Models`](/buggy-queries#get-buggy-models).

The Brand ID should match a value returned from the [`getBuggyBrands`](/buggy-queries#get-all-buggy-brands) call.

Optionally you can specify the sort order that the buggy models should be returned in and also whether to include the variants of a given buggy model. You could also make use of the [`getVariants`](/buggy-queries#get-buggy-model-variants) call to subsequently return a list of model variants if needed.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getbuggymodelslist&brandid=<BRANDID>&sort=<SORT>&variants=<VARIANTS>&double=<DOUBLE>&shrink=<SHRINK>&available=<AVAILABLE>`

#### URL Parameters

| Parameter | Type    | Required? | Default | Description                                                                                                                                                                                                                                                                                                                          |
| --------- | ------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| brandid   | Integer | Yes       | N/A     | A valid Buggy Brand ID.  Use [`getBuggyBrands`](/buggy-queries#get-all-buggy-brands) to identify a valid ID                                                                                                                                                                                                                          |
| sort      | String  | Optional  | ASC     | Sorts the order that Buggy Models are returned in (buggy\_model\_name).  Use ASC for Ascending or DESC for Descending.  If excluded, will default to ASC.                                                                                                                                                                            |
| variants  | Integer | Optional  | 0       | Specify whether to return all Buggy Model variants e.g. return the black, red, green, yellow models instead of just returning the one model.  Useful if you want to do price comparisons of all versions available, but generally speaking omitting this is all that would be needed. Use `1` to include, use `0` to exclude.        |
| double    | Integer | Optional  | 2       | Specify where to return single occupancy buggy's only (`0`), double buggy's only (`1`) or all types (`2`).                                                                                                                                                                                                                           |
| shrink    | Integer | Optional  | 0       | Specify whether to use standard folded measurements or whether to use the smallest possible measurements (e.g remove wheels or handles).  Note - if the manufacturer hasn't advised of removable components, the standard measurements will be used.  Use `1` to use the smallest buggy dimensions, use `0` to use standard.         |
| available | String  | Optional  | prices  | Specify whether to return models where My Buggy My Car has found UK retailers currently selling each model.  Use `prices`to only show models that have a price.  Use `all` to return all models regardless of availability.  Note, this option is available regardless of whether your subscription plan offers pricing information. |

{% 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=getbuggymodelslist&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>' \
--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=getbuggymodelslist&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>');
$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=getbuggymodelslist&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>", 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=getbuggymodelslist&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> Make sure to replace `<BRANDID>` with a valid Brand ID and `YOUR_BASE64_KEY` 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": "227"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "search_type": "Return Buggy Models List",
        "brand_id": "2",
        "brand_name": "Baby Jogger",
        "show_buggy_variants": "No",
        "buggy_occupancy": "All Buggy's",
        "buggy_dimensions": "Standard measurements",
        "buggy_availablity": "With Prices"
    },
    "results": [
        {
            "buggy_model_id": "xxxxxxx",
            "brand_name": "Baby Jogger",
            "buggy_model_name": "City Elite",
            "buggy_variant_name": "Red",
            "buggy_variant_colour": "Red",
            "buggy_model_isdouble": "No",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50"
        },
        {
            "buggy_model_id": "xxxxxxx",
            "brand_name": "Baby Jogger",
            "buggy_model_name": "City Elite 2",
            "buggy_variant_name": "Black",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50"
        },
        {
            "buggy_model_id": "xxxxxxx",
            "brand_name": "Baby Jogger",
            "buggy_model_name": "City Mini",
            "buggy_variant_name": "Crimson",
            "buggy_variant_colour": "Red",
            "buggy_model_isdouble": "No",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50"
        },
        {
            "buggy_model_id": "xxxxxxx",
            "brand_name": "Baby Jogger",
            "buggy_model_name": "City Mini 2",
            "buggy_variant_name": "Jet",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50"
        },
        {
            "buggy_model_id": "xxxxxxx",
            "brand_name": "Baby Jogger",
            "buggy_model_name": "City Mini 2 4 Wheel",
            "buggy_variant_name": "Jet",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50"
        }
    ]
}
```

### Get Buggy Models

Get the Buggy Models for a given Buggy Brand ID. This provides the same results as the [Get Buggy Models List](/buggy-queries#get-buggy-models-list) query above, but this returns more detailed information (including image links) for each buggy.

The Brand ID should match a value returned from the [`getBuggyBrands`](/buggy-queries#get-all-buggy-brands) call.

Optionally you can specify the sort order that the buggy models should be returned in and also whether to include the variants of a given buggy model. You could also make use of the [`getVariants`](/buggy-queries#get-buggy-model-variants) call to subsequently return a list of model variants if needed.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getbuggymodels&brandid=<BRANDID>&sort=<SORT>&variants=<VARIANTS>&double=<DOUBLE>&shrink=<SHRINK>&available=<AVAILABLE>`

#### URL Parameters

| Parameter | Type    | Required? | Default | Description                                                                                                                                                                                                                                                                                                                          |
| --------- | ------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| brandid   | Integer | Yes       | N/A     | A valid Buggy Brand ID.  Use [`getBuggyBrands`](/buggy-queries#get-all-buggy-brands) to identify a valid ID                                                                                                                                                                                                                          |
| sort      | String  | Optional  | ASC     | Sorts the order that Buggy Models are returned in (buggy\_model\_name).  Use ASC for Ascending or DESC for Descending.  If excluded, will default to ASC.                                                                                                                                                                            |
| variants  | Integer | Optional  | 0       | Specify whether to return all Buggy Model variants e.g. return the black, red, green, yellow models instead of just returning the one model.  Useful if you want to do price comparisons of all versions available, but generally speaking omitting this is all that would be needed. Use `1` to include, use `0` to exclude.        |
| double    | Integer | Optional  | 2       | Specify where to return single occupancy buggy's only (`0`), double buggy's only (`1`) or all types (`2`).                                                                                                                                                                                                                           |
| shrink    | Integer | Optional  | 0       | Specify whether to use standard folded measurements or whether to use the smallest possible measurements (e.g remove wheels or handles).  Note - if the manufacturer hasn't advised of removable components, the standard measurements will be used.  Use `1` to use the smallest buggy dimensions, use `0` to use standard.         |
| available | String  | Optional  | prices  | Specify whether to return models where My Buggy My Car has found UK retailers currently selling each model.  Use `prices`to only show models that have a price.  Use `all` to return all models regardless of availability.  Note, this option is available regardless of whether your subscription plan offers pricing information. |

{% 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=getbuggymodels&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>' \
--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=getbuggymodels&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>');
$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=getbuggymodels&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>", 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=getbuggymodels&brandid=<BRANDID>&sort=<SORT>&double=<DOUBLE>&shrink=<SHRINK>variants=<VARIANTS>&available=<AVAILABLE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> Make sure to replace `<BRANDID>` with a valid Brand ID and `YOUR_BASE64_KEY` 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": "227"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "search_type": "Return Buggy Models",
        "brand_id": "2",
        "brand_name": "Baby Jogger",
        "show_buggy_variants": "No",
        "buggy_occupancy": "All Buggy's",
        "buggy_dimensions": "Standard measurements",
        "buggy_availability": "With Prices"
    },
    "results": [
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "678",
            "buggy_model_name": "City Elite",
            "buggy_variant_name": "Black",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "11.90",
            "buggy_max_weight_kg": "15.00",
            "buggy_suitability": "From birth",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50",
            "folded_length": "85.00",
            "folded_depth": "67.50",
            "folded_height": "35.50",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/678-baby-jogger-City_Elite--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/678-baby-jogger-City_Elite--black_liUYxPyyF.jpg..."
            }
        },
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "5665",
            "buggy_model_name": "City Elite 2",
            "buggy_variant_name": "Granite",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "11.70",
            "buggy_max_weight_kg": "22.00",
            "buggy_suitability": "From Birth",
            "buggy_folded_dimensions": "82.00 x 68.00 x 36.70",
            "folded_length": "82.00",
            "folded_depth": "68.00",
            "folded_height": "36.70",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/5665-baby-jogger-City_Elite_2--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/5665-baby-jogger-City_Elite_2--black..."
            }
        },
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "5044",
            "buggy_model_name": "City Mini 2",
            "buggy_variant_name": "Jet",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "9.40",
            "buggy_max_weight_kg": "0.00",
            "buggy_suitability": "From Birth",
            "buggy_folded_dimensions": "77.00 x 66.00 x 23.50",
            "folded_length": "77.00",
            "folded_depth": "66.00",
            "folded_height": "23.50",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/5044-baby-jogger-City_Mini_2--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/5044-baby-jogger-City_Mini_2--black..."
            }
        }
    ]
}
```

### Get Buggy Model Variants

Get the Buggy Model Variants for a given Buggy Model ID.

The Buggy Model ID should match a value returned from the [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list) or [`getBuggyModels`](/buggy-queries#get-buggy-models) call.  Alternatively you can specify the Buggy Brand and Model name as defined in [`getBuggyBrand`](/buggy-queries#get-all-buggy-brands) and the [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list) or [`getBuggyModels`](/buggy-queries#get-buggy-models) calls

Optionally you can specify the sort order that the buggy model variants should be returned by.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=getvariants&buggyid=<BUGGYID>&sort=<SORT>&available=<AVAILABLE>`

#### OR

`https://api.mybuggymycar.com/api/search.php?s=getvariants&brand=<brandname>&model=<modelname>&sort=<SORT>&available=<AVAILABLE>`

#### URL Parameters

| Parameter | Type    | Required?        | Default | Description                                                                                                                                                                                                                                                                                                                          |
| --------- | ------- | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| buggyid   | Integer | Yes (alternate)  | N/A     | A valid Buggy Model ID.  Use [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list) [`getBuggyModels`](/buggy-queries#get-buggy-models) to identify a valid ID.  Alternatively, specify `brand` name and `model` name                                                                                                          |
| brand     | String  | Yes (alternate)  | N/A     | URL encoded brand name as defined in [`getBuggyBrand`](/buggy-queries#get-all-buggy-brands)                                                                                                                                                                                                                                          |
| model     | String  | Yes (with brand) | N/A     | URL encoded model name as defined in [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)or[`getBuggyModels`](/buggy-queries#get-buggy-models)                                                                                                                                                                               |
| sort      | String  | Optional         | ASC     | Sorts the order that Buggy Models are returned in (buggy\_model\_name).  Use ASC for Ascending or DESC for Descending.  If excluded, will default to ASC.                                                                                                                                                                            |
| available | String  | Optional         | prices  | Specify whether to return models where My Buggy My Car has found UK retailers currently selling each model.  Use `prices`to only show models that have a price.  Use `all` to return all models regardless of availability.  Note, this option is available regardless of whether your subscription plan offers pricing information. |

{% 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=getvariants&buggyid=<BUGGYID>&sort=<SORT>&available=<AVAILABLE>' \
--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=getvariants&buggyid=<BUGGYID>&sort=<SORT>&available=<AVAILABLE>');
$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=getvariants&buggyid=<BUGGYID>&sort=<SORT>&available=<AVAILABLE>", 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=getvariants&buggyid=<BUGGYID>&sort=<SORT>&available=<AVAILABLE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> Make sure to replace `<BUGGYID>` with a valid Buggy Model ID and `YOUR_BASE64_KEY` 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": "230"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "Return Buggy Model Variants",
        "brand_id": "35",
        "brand_name": "Phil and Teds",
        "buggy_model_id": "556",
        "buggy_availability": "All"
    },
   "results": [
        {
            "brand_id": "35",
            "brand_name": "Phil and Teds",
            "buggy_model_id": "554",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Abstract",
            "buggy_variant_colour": "Green",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "12.00",
            "buggy_max_weight_kg": "20.00",
            "buggy_suitability": "Birth to 4 Years",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",
            "folded_length": "71.00",
            "folded_depth": "57.00",
            "folded_height": "32.00",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/phil-and-teds/554-phil-and-teds-mod--green...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/554-phil-and-teds-mod--green..."
            }
        },
        {
            "brand_id": "35",
            "brand_name": "Phil and Teds",
            "buggy_model_id": "557",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Capri",
            "buggy_variant_colour": "Green",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "12.00",
            "buggy_max_weight_kg": "20.00",
            "buggy_suitability": "Birth to 4 Years",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",
            "folded_length": "71.00",
            "folded_depth": "57.00",
            "folded_height": "32.00",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/phil-and-teds/557-phil-and-teds-mod--green_...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/557-phil-and-teds-mod--green..."
            }
        },
        {
            "brand_id": "35",
            "brand_name": "Phil and Teds",
            "buggy_model_id": "555",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Noir",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "12.00",
            "buggy_max_weight_kg": "20.00",
            "buggy_suitability": "Birth to 4 Years",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",
            "folded_length": "71.00",
            "folded_depth": "57.00",
            "folded_height": "32.00",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/phil-and-teds/555-phil-and-teds-mod--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/555-phil-and-teds-mod--black..."
            }
        }
    ]
}
```

### Search for Buggies By Car

Returns a list of Buggy Models that will fit into the specified Car ID or Car Registration Number (VRM)

The returned json includes confirmation of the car that was searched for.

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

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=searchbycar&vrm=<VRM>&space=<OPTIONAL>&sort=<OPTIONAL>&brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&available=<OPTIONAL>` \
\
**OR**\
&#x20;`https://api.mybuggymycar.com/api/search.php?s=searchbycar&carid=<CARID>&space=<OPTIONAL>&sort=<OPTIONAL>&brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&available=<OPTIONAL>`

#### URL Parameters

| Parameter | Type    | Required?      | Default           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------- | ------- | -------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| carid     | Integer | Yes (or VRM)   | N/A               | A valid `carid`.  The `carid` corresponds to a car id that can be identified using the [Car ID Lookup](/car-queries#carid-lookups) searches.  Alternatively, use the `vrm` parameter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| vrm       | String  | Yes (or carid) | N/A               | An alternative to the `carid` parameter.  A valid UK registered car Vehicle Registration Mark (Car Registration Number).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| space     | String  | Optional       | boot              | <p>Select which boot measurements to use. You can use the <a href="/car-queries#get-car-details"><code>getCar</code></a> query to determine which measurements are available.  Where possible, the API will substitute if measurements are unavailable.  This will be advised in the <code>response->message</code> and <code>results->error\_message</code> <br> <strong>Options:</strong><br><code>boot</code> - core boot measurements from boot floor to parcel shelf/top of rear seats<br><code>lower</code> - use the are below the boot floor.  Where this measurement is used, the boot floor is removable.  Please note that the width and depth of the lower area are used which frequently give a smaller usable area despite the height increasing.<br><code>ceiling</code> - uses the core boot measurements but assumes the parcel-shelf is removed and the space up the boot ceiling is usable.<br><code>max\_height</code> - combines the height of the lower boot and ceiling.  As with the lower measurement, the width and depth of the lower area are also used which frequently gives a smaller usable area despite the height increase.<br><code>seats\_flat</code> - assumes the rear seats are folded flat<br><code>3rdboot</code> - if a 3rd row of seats is available, this value specifies to use the space behind the 3rd row to the height of the seats / parcel-shelf.<br><code>3rdceiling</code> - as with 3rd boot but extends to the height of the ceiling behind the 3rd row of seats.</p> |
| brand     | String  | Optional       | None              | The name of a buggy brand.  If specified, the query will only return results for this brand.  A list of buggy brands can be obtained from [`Get Buggy Brands`](/buggy-queries#get-all-buggy-brands)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| sort      | String  | Optional       | brandASC,modelASC | Specify the sort order to return.  You can specify one or both of brand or model e.g `brandASC,modelDESC` or in the singular `modelASC` (or any combination of these).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| variants  | Integer | Optional       | 0                 | Specify whether to return all Buggy Model variants e.g. return the black, red, green, yellow models instead of just returning the one model.  Useful if you want to do price comparisons of all versions available, but generally speaking omitting this is all that would be needed. Use `1` to include, use `0` to exclude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| shrink    | Integer | Optional       | 0                 | Specify whether to use standard folded measurements or whether to use the smallest possible measurements (e.g remove wheels or handles).  Note - if the manufacturer hasn't advised of removable components, the standard measurements will be used.  Use `1` to use the smallest buggy dimensions, use `0` to use standard.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| double    | Integer | Optional       | 2                 | Specify where to return single occupancy buggy's only (`0`), double buggy's only (`1`) or all types (`2`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| available | String  | Optional       | prices            | Specify whether to return models where My Buggy My Car has found UK retailers currently selling each model.  Use `prices`to only show models that have a price.  Use `all` to return all models regardless of availability.  Note, this option is available regardless of whether your subscription plan offers pricing information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

{% hint style="info" %}
**Counts against quota**: Yes (if the car is measured)
{% endhint %}

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

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=searchbycar&vrm=<VRM>brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&space=<OPTIONAL>&sort=<OPTIONAL>&available=<OPTIONAL>' \
--header 'Authorization: Basic YOUR_BASE64KEY'

# alternatively replace vrm=<VRM> with carid=<CARID> to search by Car ID Number
```

{% 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=searchbycar&vrm=<VRM>brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&space=<OPTIONAL>&sort=<OPTIONAL>&available=<OPTIONAL>');

// alternatively replace vrm=<VRM> with carid=<CARID> to search by Car ID Number

$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=searchbycar&vrm=<VRM>brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&space=<OPTIONAL>&sort=<OPTIONAL>&available=<OPTIONAL>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

# alternatively replace vrm=<VRM> with carid=<CARID> to search by Car ID Number
```

{% 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=searchbycar&vrm=<VRM>brand=<OPTIONAL>&variants=<OPTIONAL>&double=<OPTIONAL>&shrink=<OPTIONAL>&space=<OPTIONAL>&sort=<OPTIONAL>&available=<OPTIONAL>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();

// alternatively replace vrm=<VRM> with carid=<CARID> to search by Car ID Number
```

{% endtab %}
{% endtabs %}

> `[VRM]` can be replaced with a valid `[CARID]` that can be obtained by using the [Car ID Lookup](/car-queries#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": "2",
            "vrm": "",
            "manufacturer": "ABARTH",
            "model": "500",
            "body_type": "Hatchback",
            "detailed_model_name": "1.4 16V T-Jet 140 3dr Auto",
            "years": "2012 - 2015",
            "boot_measurement_available": "Yes",
            "lower_boot_measurements_available": "No",
            "third_row_measurements_available": "No",
            "measurements_requested": "boot"
        },
        "buggy_searched": {
            "buggy_brand_filter": "Baby Jogger",
            "show_buggy_variants": "Yes",
            "buggy_occupancy": "All Buggy's",
            "buggy_dimensions": "Standard measurements",
            "buggy_availability": "All"
        }
    },
    "results": [
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "16",
            "buggy_model_name": "Summit X3",
            "buggy_variant_name": "Black/Grey",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "12.70",
            "buggy_max_weight_kg": "0.00",
            "buggy_suitability": "",
            "buggy_folded_dimensions": "85.00 x 67.50 x 35.50",
            "folded_length": "85.00",
            "folded_depth": "67.50",
            "folded_height": "35.50",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/16-baby-jogger-Summit_X3--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/16-baby-jogger-Summit_X3--black..."
            }
        },
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "685",
            "buggy_model_name": "City Tour LUX",
            "buggy_variant_name": "Granite",
            "buggy_variant_colour": "Grey",
            "buggy_model_isdouble": "No",
            "buggy_weight_kg": "9.00",
            "buggy_max_weight_kg": "0.00",
            "buggy_suitability": "",
            "buggy_folded_dimensions": "67.50 x 53.50 x 22.00",
            "folded_length": "67.50",
            "folded_depth": "53.50",
            "folded_height": "22.00",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/685-baby-jogger-City_Tour_LUX--grey...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/685-baby-jogger-City_Tour_LUX--grey..."
            }
        },
        {
            "brand_id": "2",
            "brand_name": "Baby Jogger",
            "buggy_model_id": "5053",
            "buggy_model_name": "City Tour 2 Double ",
            "buggy_variant_name": "Jet",
            "buggy_variant_colour": "Black",
            "buggy_model_isdouble": "Yes",
            "buggy_weight_kg": "10.50",
            "buggy_max_weight_kg": "0.00",
            "buggy_suitability": "From Birth",
            "buggy_folded_dimensions": "66.50 x 63.00 x 25.00",
            "folded_length": "66.50",
            "folded_depth": "63.00",
            "folded_height": "25.00",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/baby-jogger/5053-baby-jogger-City_Tour_2_Double_--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/baby-jogger/5053-baby-jogger-City_Tour_2_Double_--black..."
            }
        }
    ]
}
```

### Will A Buggy Fit in a Car Boot?

Compares the specified car and buggy to determine if the buggy will fit into the boot of the car.

The returned json includes confirmation of both the car and the buggy that was specified in the request.

The `results` array will detail a simple Yes/No response to "will the buggy fit". It also details 4 positions that the buggy might or might not fit.

In the event the `results` array returns "N/A", this likely indicates that the necessary boot measurements have not been collected yet. Check the `boot_measurement_available` value from the `search` array. A "Yes" confirms that this car can be used to use the buggy comparison APIs

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

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=buggyfit&carid=<CARID>&buggyid=<BUGGYID>&space=<OPTIONAL>&shrink=<OPTIONAL>` \
\
**OR** \
\
&#x20;`https://api.mybuggymycar.com/api/car/buggyFit.php?vrm=<VRM>&buggyid=<BUGGYID>`

Note: `buggyid` can be substituted by buggy `brand`, `model` and `variant`

#### URL Parameters

| Parameter | Type    | Required?          | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------- | ------- | ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| carid     | Integer | Yes (or VRM)       | N/A     | A valid `carid`.  The `carid` corresponds to a car id that can be identified using the [Car ID Lookup](/car-queries#carid-lookups) searches.  Alternatively, use the `vrm` parameter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| vrm       | String  | Yes (or carid)     | N/A     | An alternative to the `carid` parameter.  A valid UK registered car Vehicle Registration Mark (Car Registration Number).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| buggyid   | Integer | Yes                | N/A     | A valid Buggy Model ID. Use [`getModels`](/buggy-queries#get-buggy-models) to identify a valid buggy ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| brand     | String  | Yes (alternate)    | N/A     | URL encoded brand name as defined in [`getBuggyBrand`](/buggy-queries#get-all-buggy-brands)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| model     | String  | Yes (with `brand`) | N/A     | URL encoded model name as defined in [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)or[`getBuggyModels`](/buggy-queries#get-buggy-models)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| variant   | String  | Yes (with `brand`) | N/A     | URL encoded variant name as defined in either [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)or[`getBuggyModels`](/buggy-queries#get-buggy-models) or [`getvariants`](/buggy-queries#get-buggy-model-variants)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| space     | String  | Optional           | boot    | <p>Select which boot measurements to use. You can use the <code>getCar</code> query to determine which measurements are available.  Where possible, the API will substitute if measurements are unavailable.  This will be advised in the <code>response->message</code> and <code>results->error\_message</code> <br> <strong>Options:</strong><br><code>boot</code> - core boot measurements from boot floor to parcel shelf/top of rear seats<br><code>lower</code> - use the are below the boot floor.  Where this measurement is used, the boot floor is removable.  Please note that the width and depth of the lower area are used which frequently give a smaller usable area despite the height increasing.<br><code>ceiling</code> - uses the core boot measurements but assumes the parcel-shelf is removed and the space up the boot ceiling is usable.<br><code>max\_height</code> - combines the height of the lower boot and ceiling.  As with the lower measurement, the width and depth of the lower area are also used which frequently gives a smaller usable area despite the height increase.<br><code>seats\_flat</code> - assumes the rear seats are folded flat<br><code>3rdboot</code> - if a 3rd row of seats are available, this value specifies to use the space behind the 3rd row to the height of the seats / parcel-shelf.<br><code>3rdceiling</code> - as with 3rd boot but extends to the height of the ceiling behind the 3rd row of seats.</p> |
| shrink    | Integer | Optional           | 0       | Specify whether to use standard folded measurements or whether to use the smallest possible measurements (e.g remove wheels or handles).  Note - if the manufacturer hasn't advised of removable components, the standard measurements will be used.  Use `1` to use smallest buggy dimensions, use `0` to use standard.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% hint style="info" %}
**Counts against quota**: Yes (if car is measured)
{% endhint %}

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

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=buggyfit&carid=<CARID>&buggyid=<BUGGYID>&shrink=<OPTIONAL>&space=<OPTIONAL>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'

# alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number
```

{% 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=buggyfit&carid=<CARID>&buggyid=<BUGGYID>&shrink=<OPTIONAL>&space=<OPTIONAL>');

// alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number

$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=buggyfit&carid=<CARID>&buggyid=<BUGGYID>&shrink=<OPTIONAL>&space=<OPTIONAL>", payload, headers)
res = conn.getresponse()
data = res.read()
)p
```

{% 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=buggyfit&carid=<CARID>&buggyid=<BUGGYID>&shrink=<OPTIONAL>&space=<OPTIONAL>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();

// alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number
```

{% endtab %}
{% endtabs %}

> `[VRM]` can be replaced with a valid `[CARID]` that can be obtained by using the [Car ID Lookup](broken://pages/-MUefjfWErhEXerRBq6s#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": "",
            "vrm": "XXXXXX",
            "manufacturer": "BMW",
            "model": "X3",
            "body_type": "Station Wagon",
            "detailed_model_name": "xDrive30d M Sport Auto",
            "years": "2018 - 2018",
            "boot_measurement_available": "Yes",
            "lower_boot_measurements_available": "No",
            "third_row_measurements_available": "No",
            "measurements_requested": "ceiling"
        },
        "buggy_searched": {
            "brand_id": "6",
            "brand_name": "Britax",
            "buggy_model_id": "38",
            "buggy_model_name": "B-Agile 3",
            "buggy_variant_name": "Cosmic Black",
            "buggy_folded_dimensions": "71.00 x 58.00 x 30.00",
            "buggy_dimensions": "Standard measurements",
            "buggy_availability": "With Prices",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/britax/38-britax-B-Agile_3--black...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/britax/38-britax-B-Agile_3--black..."
            }
        }
    },
    "results": [
        {
            "willItFit": "Yes",
            "fitLayingDownLR": "Yes",
            "fitLayingDownFB": "Yes",
            "fitLayingDownOnSide": "Yes",
            "fitLayingDownOnEnd": "Yes",
            "error_message": "The search was successful"
        }
    ]
}
```

### Will A Buggy Fit In A Space?

This call might be helpful if you want to see whether a buggy will fit into space in your home (a cupboard under the stairs for example), or if you want to check if your buggy is allowed as carry-on when travelling on a plane.

The call compares the folded dimensions of the specified buggy to the dimensions you specify, to determine if the buggy will fit into that space.

The returned json includes confirmation of both the buggy and the dimensions that were specified in the request.

The `results` array will detail a simple Yes/No response to "will the buggy fit". It also details 4 positions that the buggy might or might not fit.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=buggyfitother&buggyid=<BUGGYID>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>`

#### OR

`https://api.mybuggymycar.com/api/search.php?s=buggyfitother&brand=<BRAND>&model=<MODEL>&variant=<VARIANT>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>`

#### URL Parameters

| Parameter | Type    | Required?          | Default | Description                                                                                                                                                                                                                                                                                                                  |
| --------- | ------- | ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| buggyid   | Integer | Yes                | N/A     | A valid Buggy Model ID.  Use [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)  [`getBuggyModels`](/buggy-queries#get-buggy-models) to identify a valid ID                                                                                                                                                        |
| brand     | String  | Yes (alternate)    | N/A     | URL encoded brand name as defined in [`getBuggyBrand`](/buggy-queries#get-all-buggy-brands)                                                                                                                                                                                                                                  |
| model     | String  | Yes (with `brand`) | N/A     | URL encoded model name as defined in [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)or[`getBuggyModels`](/buggy-queries#get-buggy-models)                                                                                                                                                                       |
| variant   | String  | Yes (with `brand`) | N/A     | URL encoded variant name as defined in either [`getBuggyModelsList`](/buggy-queries#get-buggy-models-list)or[`getBuggyModels`](/buggy-queries#get-buggy-models) or [`getvariants`](/buggy-queries#get-buggy-model-variants)                                                                                                  |
| shrink    | Integer | Optional           | 0       | Specify whether to use standard folded measurements or whether to use the smallest possible measurements (e.g remove wheels or handles).  Note - if the manufacturer hasn't advised of removable components, the standard measurements will be used.  Use `1` to use the smallest buggy dimensions, use `0` to use standard. |
| width     | Integer | Yes                | N/A     | Specify the width in cm of the space you want the buggy to fit in to                                                                                                                                                                                                                                                         |
| height    | Integer | Yes                | N/A     | Specify the height in cm of the space you want the buggy to fit in to                                                                                                                                                                                                                                                        |
| depth     | Integer | Yes                | N/A     | Specify the depth in cm of the space you want the buggy to fit in to                                                                                                                                                                                                                                                         |

{% hint style="info" %}
**Counts against quota**: Yes (if car is measured)
{% endhint %}

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

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=buggyfitotherbuggyid&<BUGGYID>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>' \
--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=buggyfitotherbuggyid&<BUGGYID>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>');
$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=buggyfitotherbuggyid&<BUGGYID>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>", 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=buggyfitotherbuggyid&<BUGGYID>&shrink=<SHRINK>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
```

{% endtab %}
{% endtabs %}

> Make sure to replace `<WIDTH>`, `<HEIGHT>` and `<DEPTH>` with a positive value in cm, `BUGGYID` with a valid Buggy Model ID and `YOUR_BASE64_KEY` 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": "232"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "buggy_searched": {
            "brand_id": "35",
            "brand_name": "Phil and Teds",
            "buggy_model_id": "557",
            "buggy_model_name": "mod",
            "buggy_variant_name": "Capri",
            "buggy_folded_dimensions": "71.00 x 57.00 x 32.00",
            "buggy_dimensions": "Standard measurements",
            "buggy_availability": "With Prices",
            "images": {
                "buggy_image_url": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcdefault450/brands/phil-and-teds/557-phil-and-teds-mod--green...",
                "buggy_thumbnail": "https://ik.imagekit.io/mybuggymycar/buggy-images/tr:n-mbmcthumbnail/brands/phil-and-teds/557-phil-and-teds-mod--green..."
            }
        },
        "dimensions_checked": {
            "width": "100",
            "height": "100",
            "depth": "50"
        }
    },
    "results": [
        {
            "willItFit": "Yes",
            "fitLayingDownLR": "No",
            "fitLayingDownFB": "No",
            "fitLayingDownOnSide": "Yes",
            "fitLayingDownOnEnd": "Yes",
            "error_message": "The comparison was successful"
        }
    ]
}
```


# Car Queries

This page details the Car queries available from the API

### 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](/car-queries#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](/car-queries#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](/car-queries#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`](/car-queries#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](/car-queries#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`](/car-queries#carid-lookup-1-getmakes) query. |
| model     | String | Yes       | N/A     | The name of a car model as returned by the [`getModels`](/car-queries#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](/car-queries#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced witht he name of a Car Model returned from the [getModels](/car-queries#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`](/car-queries#carid-lookup-1-getmakes) query. |
| model     | String | Yes       | N/A     | The name of a car model as returned by the [`getModels`](/car-queries#carid-lookup-2-getmodels) query       |
| fuel      | String | Yes       | N/A     | The name of a fuel type returned by the [`getFuelType`](/car-queries#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](/car-queries#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced with the name of a Car Model returned from the [getModels](/car-queries#carid-lookup-2-getmodels) query. `<FUELTYPE>` should be replace with one of the Fuel Types returned from the [getFuelType](/car-queries#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`](/car-queries#carid-lookup-1-getmakes) query. |
| model     | String  | Yes       | N/A     | The name of a car model as returned by the [`getModels`](/car-queries#carid-lookup-2-getmodels) query.      |
| fuel      | String  | Yes       | N/A     | The name of a fuel type returned by the [`getFuelType`](/car-queries#carid-lookup-3-getfueltype) query.     |
| year      | Integer | Yes       | N/A     | A year id returned from the [`getYears`](/car-queries#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](/car-queries#carid-lookup-1-getmakes) query. `<MODEL>` should be replaced witht he name of a Car Model returned from the [getModels](/car-queries#carid-lookup-2-getmodels) query `<FUELTYPE>` should be replace with one of the Fuel Types returned from the [getFuelType](/car-queries#carid-lookup-3-getfueltype) query. `<YEARID>` should be replaced with `year_group_id` returned from the [getYears](/car-queries#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"
        }
    ]
}
```


# Generic Tools

### Will an Item Fit into a Car Boot?

This call is designed to compare whether ***any*** item will fit into a specified car boot. Perhaps you want to see if a large parcel will fit in the boot, or you want to check if your golf clubs will fit?

The call compares the dimensions of the item you specify to the measured space of the car.

The returned json includes confirmation of both the car and the dimensions that were specified in the request.

The `results` array will detail a simple Yes/No response to "will the item fit". It also details 4 positions that the item might or might not fit.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=somethingfit&vrm=<VRM>&space=<SPACE>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>"`\
\
&#x20;**OR** \
&#x20;`https://api.mybuggymycar.com/api/search.php?s=somethingfit&carid=<CARID>&space=<SPACE>&width=<WIDTH>&height=<HEIGHT>&depth=<DEPTH>"`

#### URL Parameters

| Parameter | Type    | Required?      | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------- | ------- | -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| carid     | Integer | Yes (or VRM)   | N/A     | A valid `carid`.  The `carid` corresponds to a car id that can be identified using the [Car ID Lookup](/car-queries#carid-lookups) searches.  Alternatively, use the `vrm` parameter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| vrm       | String  | Yes (or carid) | N/A     | An alternative to the `carid` parameter.  A valid UK registered car Vehicle Registration Mark (Car Registration Number).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| space     | String  | Optional       | boot    | <p>Select which boot measurements to use. You can use the <a href="/car-queries#get-car-details"><code>getCar</code></a> query to determine which measurements are available.  Where possible, the API will substitute if measurements are unavailable.  This will be advised in the <code>response->message</code> and <code>results->error\_message</code> <br> <strong>Options:</strong><br><code>boot</code> - core boot measurements from boot floor to parcel shelf/top of rear seats<br><code>lower</code> - use the are below the boot floor.  Where this measurement is used, the boot floor is removable.  Please note that the width and depth of the lower area are used which frequently give a smaller usable area despite the height increasing.<br><code>ceiling</code> - uses the core boot measurements but assumes the parcel-shelf is removed and the space up the boot ceiling is usable.<br><code>max\_height</code> - combines the height of the lower boot and ceiling.  As with the lower measurement, the width and depth of the lower area are also used which frequently gives a smaller usable area despite the height increase.<br><code>seats\_flat</code> - assumes the rear seats are folded flat<br><code>3rdboot</code> - if a 3rd row of seats are available, this value specifies to use the space behind the 3rd row to the height of the seats / parcel-shelf.<br><code>3rdceiling</code> - as with 3rd boot but extends to the height of the ceiling behind the 3rd row of seats.</p> |
| width     | Integer | Yes            | N/A     | Specify the width in cm of the item you want to fit in the car boot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| height    | Integer | Yes            | N/A     | Specify the height in cm of the item you want to fit in the car boot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| depth     | Integer | Yes            | N/A     | Specify the depth in cm of the item you want to fit in the car boot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% hint style="info" %}
**Counts against quota**: Yes (if the car is measured)
{% endhint %}

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

```bash
curl --location --request GET 'https://api.mybuggymycar.com/api/search.php?s=somethingfit&carid=<CARID>&height=<HEIGHT>&width=<WIDTH>&depth=<DEPTH>&space=<SPACE>' \
--header 'Authorization: Basic YOUR_BASE64_KEY'

# alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number
```

{% 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=somethingfit&carid=<CARID>&height=<HEIGHT>&width=<WIDTH>&depth=<DEPTH>&space=<SPACE>');

// alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number

$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=somethingfit&carid=<CARID>&height=<HEIGHT>&width=<WIDTH>&depth=<DEPTH>&space=<SPACE>", payload, headers)

# alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number

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=somethingfit&carid=<CARID>&height=<HEIGHT>&width=<WIDTH>&depth=<DEPTH>&space=<SPACE>");
xhr.setRequestHeader("Authorization", "Basic YOUR_BASE64_KEY");

xhr.send();
// alternatively replace carid=<CARID> with vrm=<VRM> to search by Car Registration Number
```

{% endtab %}
{% endtabs %}

> `[VRM]` can be replaced with a valid `[CARID]` that can be obtained by using the [Car ID Lookup](/car-queries#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": "238"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "car_searched": {
            "carID": "",
            "vrm": "hk68yma",
            "manufacturer": "BMW",
            "model": "X3",
            "body_type": "Station Wagon",
            "detailed_model_name": "xDrive30d M Sport Auto",
            "years": "2018 - 2018",
            "boot_measurement_available": "Yes",
            "lower_boot_measurements_available": "No",
            "third_row_measurements_available": "No",
            "measurements_requested": "boot"
        },
        "item_dimensions_checked": {
            "width": "100",
            "height": "50",
            "depth": "50"
        }
    },
    "results": [
        {
            "willItFit": "No",
            "fitLayingDownLR": "No",
            "fitLayingDownFB": "No",
            "fitLayingDownOnSide": "No",
            "fitLayingDownOnEnd": "No",
            "error_message": "The comparison was successful"
        }
    ]
}
```

### About - Pre-written Help/About wording

This query provides two sets of pre-written text that you may wish to incorporate into your solution.

The texts explain how the results are derived and outline's some 'caveats' and limitations that your users may not be aware of.

The two texts cover Car and Buggy queries and can be recalled independently or together in either plain text or html format.

The html format incorporates class and id which would allow you to style the output to match your site.

#### HTTP Request

`https://api.mybuggymycar.com/api/search.php?s=about&version=<VERSION>&format=<FORMAT>`

#### URL Parameters

| Parameter | Type   | Required? | Default | Description                                                                                                                                                                                                                                                                        |
| --------- | ------ | --------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| version   | String | Optional  | both    | <p>Defines whether to return the car text, buggy text or both. <br> <strong>Options:</strong><br><code>car</code> - returns the car text only.<br><code>buggy</code> - returns the buggy text only<br><code>both</code> - returns both the buggy and car text</p>                  |
| format    | String | Optional  | text    | <p>Defines whether to return the text in plain text or in html format.<br> <strong>Options:</strong><br><code>text</code> - returns the text in plain text format. <br><code>html</code> - returns the text in html format that includes class and id's to aid custom styling.</p> |

{% 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=about&format=<FORMAT>&version=<VERSION>' \
--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=about&format=<FORMAT>&version=<VERSION>');
$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" %}

```
import http.client

conn = http.client.HTTPSConnection("api.mybuggymycar.com")
payload = ''
headers = {
  'Authorization': 'Basic YOUR_BASE64_KEY'
}
conn.request("GET", "/api/search.php?s=about&format=<FORMAT>&version=<VERSION>", 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=about&format=<FORMAT>&version=<VERSION>");
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": "239"
    },
    "response": {
        "code": "200",
        "code_description": "Ok",
        "message": "Query successful"
    },
    "search": {
        "type": "about_text",
        "about_text_version": "both",
        "about_format": "html"
    },
    "results": {
        "car": {
            "about_type": "car",
            "about_text": "<h2 class=“mbmc” id=“mbmc_car_header”>Car</h2><div class=“mbmc_text” id=“mbmc_car_text”>All car boot dimension data is captured by our team.  As part of the process ..."
        },
        "buggy": {
            "about_type": "buggy",
            "about_text": "<h2 class=“mbmc” id=“mbmc_buggy_header”>Buggy</h2><div class=“mbmc_text” id=“mbmc_buggy_text”>All Buggy and Travel System sizing information is taken directly from ..."
        }
    }
}
```


# Errors

We use standard HTTP Error codes - some are detailed below for reference. Additionally, where an error has occurred we attempt to return the message in the JSON response in either `messages` or `error_messages`

{% hint style="info" %}
The `response` section of the API response details the HTTP response codes.  HTTP response codes are also set but we would recommend parsing the [`response`](/api-response-structure#response) section of the returned JSON for errors rather than relying on the HTTP response code.
{% endhint %}

| code | code\_description | message / details                                                                                                                                                                           |
| ---- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | Ok                | The query was successful irrespective of whether the results give a positive response                                                                                                       |
| 400  | Bad Request       | Likely returned if a parameter is missing from a query.  The `message` value will detail the parameter that is missing.  Check this documentation for the correct parameter values.         |
| 401  | Unauthorized      | It's likely your Subscription Key or API Key are not valid                                                                                                                                  |
| 403  | Forbidden         | Your subscription doesn't allow for the call made or you've implemented Whitelist restrictions in your control panel - please check these settings allow your system to connect             |
| 404  | Not Found         | You've requested a page or search query that doesn't exist. **PLEASE NOTE** - we also return a 404 in the event that no results have been found                                             |
| 422  | Unprocessable     | The structure of the query is correct, but one of the parameters contains an invalid value.  Where possible, the system will use default values to mitigate but this isn't always possible. |
| 503  | Maintenance       | We're currently undertaking some maintenance.  We currently have a nightly maintenance routine that runs for circa 1 hour.                                                                  |


