GetManufacturerDetails
async function GetManufacturerDetails(
manufacturer: string | number,
doFetch?: boolean
): Promise<NhtsaResponse<GetManufacturerDetailsResults> | string>
💡 More In Depth
See: Package Reference
Description
GetManufacturerDetails
provides the details for a specific 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 GetManufacturerDetailsResults objects in the Results
key.
=> Promise<NhtsaResponse<GetManufacturerDetailsResults>>
type NhtsaResponse<GetManufacturerDetailsResults> = {
Count: number
Message: string
Results: Array<GetManufacturerDetailsResults>
SearchCriteria: string
}
🔍 Click to Show Full Example Response
// Using GetMakesForVehicleType('truck') - truncated for brevity
const exampleResponse = {
Count: 1,
Message: 'Response returned successfully',
Results: [
{
Address: '1 Tesla Road',
Address2: null,
City: 'Austin',
ContactEmail: 'erwilliams@tesla.com',
ContactFax: null,
ContactPhone: '(508)272-8358',
Country: 'UNITED STATES (USA)',
DBAs: 'Tesla, Inc.',
EquipmentItems: [],
LastUpdated: '/Date(1665153455790-0400)/',
ManufacturerTypes: [
{
Name: 'Completed Vehicle Manufacturer',
},
],
Mfr_CommonName: 'Tesla',
Mfr_ID: 955,
Mfr_Name: 'TESLA, INC.',
OtherManufacturerDetails: null,
PostalCode: '78725',
PrimaryProduct: null,
PrincipalFirstName: 'Elon Musk',
PrincipalLastName: null,
PrincipalPosition: 'CEO',
StateProvince: 'TEXAS',
SubmittedName: 'David Kim',
SubmittedOn: '/Date(1665152176543-0400)/',
SubmittedPosition: 'Corporate Counsel, Regulatory',
VehicleTypes: [
{
GVWRFrom: 'Class 1A: 3,000 lb or less (1,360 kg or less)',
GVWRTo: 'Class 1D: 5,001 - 6,000 lb (2,268 - 2,722 kg)',
IsPrimary: true,
Name: 'Passenger Car',
},
{
GVWRFrom: 'Class 8: 33,001 lb and above (14,969 kg and above)',
GVWRTo: 'Class 8: 33,001 lb and above (14,969 kg and above)',
IsPrimary: false,
Name: 'Truck ',
},
{
GVWRFrom: 'Class 2E: 6,001 - 7,000 lb (2,722 - 3,175 kg)',
GVWRTo: 'Class 2E: 6,001 - 7,000 lb (2,722 - 3,175 kg)',
IsPrimary: false,
Name: 'Multipurpose Passenger Vehicle (MPV)',
},
],
},
],
SearchCriteria: null,
}
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/GetManufacturerDetails/tesla?format=json'
💡 See: BYOF - Bring Your Own Fetch
Type - GetManufacturerDetailsResults
type GetManufacturerDetailsResults = {
Address: string | null
Address2: string | null
City: string | null
ContactEmail: string | null
ContactFax: string | null
ContactPhone: string | null
Country: string | null
DBAs: string | null
EquipmentItems: Array<unknown>
LastUpdated: string
ManufacturerTypes: Array<{
Name: string
}>
Mfr_CommonName: string | null
Mfr_ID: number | null
Mfr_Name: string | null
OtherManufacturerDetails: string | null
PostalCode: string | null
PrimaryProduct: string | null
PrincipalFirstName: string | null
PrincipalLastName: string | null
PrincipalPosition: string | null
StateProvince: string | null
SubmittedName: string | null
SubmittedOn: string
SubmittedPosition: string | null
VehicleTypes: Array<{
GVWRFrom: string
GVWRTo: string
IsPrimary: boolean
Name: string
}>
}
Ƭ GetManufacturerDetailsResults: Object
Objects returned in the Results
array of GetManufacturerDetails
endpoint response.
Examples
Examples 1-2:
Fetches data from VPIC API
Returns:
=> Promise<NhtsaResponse<GetManufacturerDetailsResults>>
Example 1: Get Manufacturer Details by Name
import { GetManufacturerDetails } from '@shaggytools/nhtsa-api-wrapper'
const response = await GetManufacturerDetails('tesla')
Example 2: Get Manufacturer Details by ID
import { GetManufacturerDetails } from '@shaggytools/nhtsa-api-wrapper'
const response = await GetManufacturerDetails(955)
Examples 3-4:
Does NOT fetch data from VPIC API
Returns:
=> Promise<string>
Example 3: Get Manufacturer Details by Name and doFetch = false
import { GetManufacturerDetails } from '@shaggytools/nhtsa-api-wrapper'
const url = await GetManufacturerDetails('tesla', false)
// url: 'https://vpic.nhtsa.dot.gov/api/vehicles/GetManufacturerDetails/tesla?format=json'
Example 4: Get Manufacturer Details by ID and doFetch = false
import { GetManufacturerDetails } from '@shaggytools/nhtsa-api-wrapper'
const url = await GetManufacturerDetails(955, false)
// url: 'https://vpic.nhtsa.dot.gov/api/vehicles/GetManufacturerDetails/955?format=json'