# 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.md#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="/pages/-MUefpRjY_AzPO54gmVe#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.md#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 ..."
        }
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.mybuggymycar.com/special-tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
