GetMakeForManufacturer
async function GetMakeForManufacturer(
manufacturer: string | number,
doFetch?: boolean
): Promise<NhtsaResponse<GetMakeForManufacturerResults>
💡 More In Depth
See: Package Reference
Description
GetMakeForManufacturer
returns all the Makes in the vPIC dataset for a specified manufacturer that is requested. Multiple results are returned in case of multiple matches.
manufacturer
name can be a partial name, or a full name for more specificity, e.g. "988", "honda", "HONDA OF CANADA MFG., INC.", etc.
- If supplied
manufacturer
is a number - method will do exact match on Manufacturer's Id. - If supplied
manufacturer
is a string - it will look for manufacturers whose name is LIKE the provided name. It accepts a partial manufacturer name as an input.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
manufacturer | string | number | undefined | Manufacturer Name or ID |
doFetch? | boolean | true | Whether to fetch the data or just return the URL (default: true ) |
📝 NOTE
Set doFetch
to false
if you want to fetch the data yourself.
- See BYOF - Bring Your Own Fetch for more info.
Returns
Returns a Promise that resolves to a NhtsaResponse object containing an array of GetMakeForManufacturerResults objects in the Results
key.
=> Promise<NhtsaResponse<GetMakeForManufacturerResults>>
type NhtsaResponse<GetMakeForManufacturerResults> = {
Count: number
Message: string
Results: Array<GetMakeForManufacturerResults>
SearchCriteria: string
}
🔍 Click to Show Full Example Response
// Using GetMakeForManufacturer('honda')
const exampleResponse = {
Count: 15,
Message: 'Results returned successfully',
Results: [
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'HONDA MOTOR CO., LTD',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'AMERICAN HONDA MOTOR CO., INC.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'HONDA OF CANADA MFG., INC.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'HONDA OF THE U.K. MFG., LTD.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'HONDA DE MEXICO',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'THAI HONDA CO., LTD.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'HONDA VIETNAM CO., LTD.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'MOTO HONDA DA AMAZONIA LTDA.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'SUNDIRO HONDA MOTORCYCLE CO., LTD.',
},
{
Make_ID: 474,
Make_Name: 'HONDA',
Mfr_Name: 'MONTESA HONDA SA',
},
{
Make_ID: 475,
Make_Name: 'ACURA',
Mfr_Name: 'HONDA MOTOR CO., LTD',
},
{
Make_ID: 475,
Make_Name: 'ACURA',
Mfr_Name: 'AMERICAN HONDA MOTOR CO., INC.',
},
{
Make_ID: 475,
Make_Name: 'ACURA',
Mfr_Name: 'HONDA OF CANADA MFG., INC.',
},
{
Make_ID: 542,
Make_Name: 'ISUZU',
Mfr_Name: 'HONDA MOTOR CO., LTD',
},
{
Make_ID: 7351,
Make_Name: 'SUNDIRO HONDA MOTORCYCLE CO. LTD',
Mfr_Name: 'SUNDIRO HONDA MOTORCYCLE CO., LTD.',
},
],
SearchCriteria: 'Manufacturer:honda',
}
If doFetch
is set to false
Returns a URL string that can be used to fetch the data, does not fetch the data internally.
=> Promise<string>
// ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakeForManufacturer/?format=json'
💡 See: BYOF - Bring Your Own Fetch
Type - GetMakeForManufacturerResults
type GetMakeForManufacturerResults = {
Make_ID: number
Make_Name: string
Mfr_Name: string
}
Ƭ GetMakeForManufacturerResults: Object
Objects returned in the Results
array of GetMakeForManufacturer
endpoint response.
Examples
Examples 1-2:
Fetches data from VPIC API
Returns:
=> Promise<NhtsaResponse<GetMakeForManufacturerResults>>
Example 1: Get Makes for Manufacturer Name
import { GetMakeForManufacturer } from '@shaggytools/nhtsa-api-wrapper'
const response = await GetMakeForManufacturer('honda')
Example 2: Get Makes for Manufacturer ID
import { GetMakeForManufacturer } from '@shaggytools/nhtsa-api-wrapper'
const response = await GetMakeForManufacturer(988)
Examples 3-4:
Does NOT fetch data from VPIC API
Returns:
=> Promise<string>
Example 3: Get Makes for Manufacturer Name with doFetch = false
import { GetMakeForManufacturer } from '@shaggytools/nhtsa-api-wrapper'
const url = await GetMakeForManufacturer('honda', false)
// url = 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakeForManufacturer/honda?format=json'
Example 4: Get Makes for Manufacturer ID with doFetch = false
import { GetMakeForManufacturer } from '@shaggytools/nhtsa-api-wrapper'
const url = await GetMakeForManufacturer(988, false)
// url = 'https://vpic.nhtsa.dot.gov/api/vehicles/GetMakeForManufacturer/988?format=json'