Skip to content

Latest commit

 

History

88 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CarQuery API

Build Status Build Status

Wrapper for the CarQuery API in JavaScript with Promise support.

Installing

Using npm:

npm install car-query

Example

Initialize the CarQuery object.

const carQuery = new CarQuery();

Retrieve the minimum and maximum years in the CarQuery database.

carQuery.getYears()
    .then(years => {
        // Process data
    });

Retrieve all of the makes produced in a given year.

carQuery.getMakes(2018)
    .then(makes => {
        // Process data
    });

Retrieve all of the models meeting the search criteria.

const searchCriteria = {
    year: 2018,
    make: 'Ford'
}

carQuery.getModels(searchCriteria)
    .then(models => {
        // Process data
    });

Retrive detailed information on the specified model by ID number.

carQuery.getModelDetail(44859)
    .then(years => {
        // Process data
    });

Add more search criteria

const searchCriteria = {
    year: 2018,
    make: 'Ford',
    soldInUSA: true,
    body: Bodystyle.SUV
}

carQuery.getModels(searchCriteria)
    .then(models => {
        // Process data
    });

Retrieve trim data for models meeting the search criteria.

const searchCriteria = {
    year: 2018,
    make: 'Ford',
    model: 'Escape'
}

carQuery.getTrims(searchCriteria)
    .then(trims => {
        // Process data
    });

API

Instance methods

getYears();
getMakes(year[, soldInUSA]);
getModels(params);
getTrims(params);
getModelDetail(modelId);

Known Issues

The CarQuery API does not contain the Access-Control-Allow-Origin header in its responses, so this package cannot be used within a browser.

About

Library for using the CarQuery API

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages