Cached Image

Retrieve MarketCheck's cached version of car images from vehicle detail pages

MarketCheck caches few images from vehicle detail pages to make them available for later use when the original source may not be accessible. This endpoint allows you to retrieve these cached images using the unique listing identifier and image ID.

Overview

  • The links to these images are provided in the Search API and Listing API responses
    • For security concerns, the api_key is not included in the URLs by default, you can include it by using the append_api_key=true query parameter
    • You need to add the api_key to the request to access the image
  • A private caching policy is applied to these images, allowing them to be cached on individual machines for up to 4 hours
  • Public caching is not allowed, meaning these images should not be stored on public CDNs or shared publicly
If you have a data feed from MarketCheck, that includes cached image URLs, you can use this API to retrieve the cached images directly using the specific listing identifier and image_id provided in the URLs

Base Path

GET https://api.marketcheck.com/v2/image/cache/car/{listing_id}/{image_id}

Path Parameters:

  • listing_id: Specific identifier for the vehicle listing
  • image_id: Specific identifier for the cached image

Often these URLs are provided in the response of the Inventory Search API or the Car Listing API

The following example demonstrates how to use the Cached Image API to retrieve a cached image using the listing ID and image ID.

request.js
import axios from 'axios';

const options = {
method: 'GET',
url: 'https://api.marketcheck.com/v2/image/cache/car/b88c44a717bc0849bb58b4b64e9834a5/a777f1880b84a982e944441f23a76aca',
params: {api_key: 'YOUR_API_KEY'},
headers: {Accept: 'image/jpeg, application/json'}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

Request

To retrieve a cached image, you need to make a GET request to the Cached Image API endpoint with the required parameters.

Parameters

1 Params
api_key
string required

Your MarketCheck API authentication key. Required for every request, unless OAuth is used.

Required Parameters

  • listing_id: The specific identifier for the car listing you want to retrieve the cached image for. This parameter is case-sensitive and must be provided in the URL path.
  • image_id: The specific identifier for the cached image you want to retrieve. This parameter is also case-sensitive and must be provided in the URL path.

Use Cases & Examples

Retrieve Cached Image

After performing a search using the Inventory Search API, in response you will receive list of cached image URLs for each listing in media.photo_links_cached field.

You can use those URLs to retrieve the cached images directly.

Example:

request.js
import axios from 'axios';

const options = {
method: 'GET',
url: 'https://api.marketcheck.com/v2/image/cache/car/b88c44a717bc0849bb58b4b64e9834a5/a777f1880b84a982e944441f23a76aca',
params: {api_key: 'YOUR_API_KEY'},
headers: {Accept: 'image/jpeg, application/json'}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

Response

Success Response:

  • 200 OK - Returns the cached image with appropriate content headers.
  • Headers:
    • Content-Type: The MIME type of the image image/jpeg
    • Cache-Control: Public, max-age=14400 (4 hours)
    • Content-Length: Size of the image file in bytes

Error Response:

Status CodeDescriptionCommon Causes
400Bad RequestInvalid parameter values
401UnauthorizedMissing/invalid API key
403ForbiddenAccess denied to resource
422Unprocessable EntityInvalid listing_id or image_id
429Too Many RequestsRate limit exceeded
500Internal Server ErrorTemporary server issues
502Bad GatewayIssues with upstream services
503Service UnavailableAPI maintenance or downtime

Response Schema

The response schema for the Cached Image API is straightforward, as it returns the JPEG image file directly. The response headers are set to indicate the content type and caching policy.

See Also